Assembly reference as a relative path?

R

Richard

We are distributing a VS2003 solution to our customers that
includes a .NET assembly (dll file) and a sample project for
how to use the dll. The customer can then customize the sample
or add a new project to the solution.

The problem is that the customers cannot simply take the
solution we distribute and build it. VS2003 is saving the
reference to the dll as an fully qualified absolute path
(not relative to the project), so after installing the
solution, each customer has to first manually add in the
dll reference to where it was installed on their computer.
Is there any way around this? It is possible to initially
enter a relative path but VS saves it as an absolute path.
 
S

SP

Richard said:
We are distributing a VS2003 solution to our customers that
includes a .NET assembly (dll file) and a sample project for
how to use the dll. The customer can then customize the sample
or add a new project to the solution.

The problem is that the customers cannot simply take the
solution we distribute and build it. VS2003 is saving the
reference to the dll as an fully qualified absolute path
(not relative to the project), so after installing the
solution, each customer has to first manually add in the
dll reference to where it was installed on their computer.
Is there any way around this? It is possible to initially
enter a relative path but VS saves it as an absolute path.

If you look in a project file in notepad or an XML editor it appears that
references to a DLL are saved with relative path using the HintPath tag.
When you look at the properties on a referenced DLL the Path shown is
absolute but it would seem that VS is just resolving the HintPath to an
actual path. Assuming you have a bin directory and a samples directory
within your install directory (which can be changed by the person installing
the software), make sure the DLL is within the hierarchy of your installtion
directory so the HintPath will be something like "..\..\bin\MyDll.dll". i.e.
up to the Samples directory, up to the install directory, down to the bin
directory.

HTH

SP
 
R

Richard

I looked in the project file and there are no HintPath tags at all
(including none for the .NET Framework dll references). I inserted
a HintPath tag for my dll reference and Visual Studio still reports
it as missing when I load the project.

I happen to be building for Pocket PC platform, though I don't think
it should make any difference.

- Richard
 
S

SP

Richard said:
I looked in the project file and there are no HintPath tags at all
(including none for the .NET Framework dll references). I inserted
a HintPath tag for my dll reference and Visual Studio still reports
it as missing when I load the project.

I happen to be building for Pocket PC platform, though I don't think
it should make any difference.

PocketPC project does use a different layout. I did the following and it
worked fine for me. I created a PocketPC project. I copied a DLL into the
project root folder. I added a reference to this DLL. I closed the project
and moved the project folder to a different location (and also renamed the
folder). I opened the project without any problem.

SP
 
R

Richard

Thanks, it worked for me also. I found that ReferencePath in the project file
is normally set to the full absolute path, except if the reference is in the
root then it is set to null. The lack of relative path is a clear deficiency
in Visual Studio and I guess this is the best I can do for now. The DLL in my
case is supposed to be a common file that can be referenced by multiple
projects. To distribute a solution that works out of the box would mean
adding a redundant copy of the DLL to each project.

- Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top