Discussion:
why relative hint path but absolute reference path
(too old to reply)
gerry
2004-09-22 14:12:16 UTC
Permalink
I have a vs.net 2002 solution that contains a number of projects
All projects are created in folders under the solution folder.
The idea here is that this entire solution should be 'moveable' ie. copied
to and useable from a new directory or computer.
And it almost is.

One project makes reference to an existing .net dll that also exists in a
folder under the solution folder.
The project file shows a relative hint path to the dll ie
"..\..\dllFolder\my.dll"
If I move the solution to a new folder and the open solution from the new
location, the dll can no longer be found. if i restore the original
solution folder, the dll is once again found. so obviously, although the
project file includes a relative hint path, vs.net is in fact looking for
the dll at an absolute location. This is causing headaches as this solution
cannot be 'passed around' without re-adding the reference to this dll.

is there some setting somewhere to get the relative path used ?
there does not seem to be any problem using relative project references - is
there some trick using a dummy project to get this to work ?

gerry
Gary Chang
2004-09-23 06:55:19 UTC
Permalink
Hi gerry,
Post by gerry
is there some setting somewhere to get the relative path used ?
there does not seem to be any problem using relative project references -
is there some trick using a dummy project to get this to work ?
How do you reference that existing .net dll in your project, by wizard?
If so, the wizard appears to use an absolute path to locate the .NET
assembly.

For using a project, I think if you have that .net dll's project, you can
copy that project directory into your solution directory and add that
project to your current solution, then reference the project...


Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
gerry
2004-09-23 17:31:16 UTC
Permalink
Hi Gary ,
thanks for the reply
i add the reference by right clicking the project in solution explorer and
selecting add reference and then browse to the dll.
there is no project for this particular dll, it is generated manually using
jbimp.
Post by Gary Chang
Hi gerry,
Post by gerry
is there some setting somewhere to get the relative path used ?
there does not seem to be any problem using relative project
references -
Post by Gary Chang
is there some trick using a dummy project to get this to work ?
How do you reference that existing .net dll in your project, by wizard?
If so, the wizard appears to use an absolute path to locate the .NET
assembly.
For using a project, I think if you have that .net dll's project, you can
copy that project directory into your solution directory and add that
project to your current solution, then reference the project...
Thanks for your understanding!
Best regards,
Gary Chang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Gary Chang
2004-09-24 06:48:53 UTC
Permalink
Hi gerry,
Post by gerry
i add the reference by right clicking the project in solution explorer
and selecting add reference and then browse to the dll.
Post by gerry
there is no project for this particular dll, it is generated manually
using jbimp.
Since you don't have the .NET dll's generic project, using a project
reference appears to be impossible...


Thanks!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Gary Chang
2004-09-27 02:08:07 UTC
Permalink
Hi gerry,

Would you please give us an update of this issue?
If you have any more concerns on it, please feel free to post here.


Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
gerry
2004-09-27 23:32:09 UTC
Permalink
basically , we are forced to re-add the dll reference when the solution is
moved/copied/passed around.
Post by Gary Chang
Hi gerry,
Would you please give us an update of this issue?
If you have any more concerns on it, please feel free to post here.
Thanks for your understanding!
Best regards,
Gary Chang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Gary Chang
2004-09-29 09:00:34 UTC
Permalink
Thanks for your response, gerry,
Post by gerry
basically , we are forced to re-add the dll reference when the solution is
moved/copied/passed around.
.. it appears the only workaround under this scenario.


Good Luck!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Gary Chang
2004-09-30 08:57:17 UTC
Permalink
Hi gerry,

Additionaly, the project's reference file should use the absolute path such
as:
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath
="C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
/>
..

And the project include files would use the relative path to locate:
<Files>
<Include>
<File
RelPath = "App.ico"
BuildAction = "Content"
/>
..

So do you make sure the referenced DLL file use a relative path in the
.csproj file?


Thanks!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
gerry
2004-09-30 14:58:29 UTC
Permalink
Hi Gary ,

VS.NET is creating all paths in the project file as relative , including the
references.

the .csproj.user does contain absolute paths in ReferencePath - I suppose if
we don't distribute this file then new references would only have to be
added once per machine rather than after every update.

gerry
Post by Gary Chang
Hi gerry,
Additionaly, the project's reference file should use the absolute path such
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath
="C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
/>
..
<Files>
<Include>
<File
RelPath = "App.ico"
BuildAction = "Content"
/>
..
So do you make sure the referenced DLL file use a relative path in the
csproj file?
Thanks!
Best regards,
Gary Chang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Yan-Hong Huang[MSFT]
2004-10-05 07:02:18 UTC
Permalink
Hi Gerry,

When you need to use a type (such as a class or structure) contained in
another assembly, you must set a reference to that assembly. This creates
an assembly reference within the client assembly's manifest that identifies
the name and version of the dependency. Visual Studio .NET supports two
types of references: project references and file references.

The Projects page within the Visual Studio .NET Add Reference dialog box
lists all of the other projects in the current solution. This allows you to
create a project reference to another project in the same solution. Project
references are the recommended way to set references because they offer
many advantages.
(Note Project references are the main reason you should adopt a single
solution or partitioned single solution model wherever possible.)

If you can't use a project reference because you need to reference an
assembly outside of your current solution's project set, you must set a
file reference. The following are the two ways to set a file reference:

To reference a .NET Framework assembly, you select the assembly from the
list displayed on the .NET tab of the Add References dialog box.
You can use the Browse button in the Add Reference dialog box.
If you set a file reference, the path to the assembly is stored in the
source controlled project file. A relative path is stored for local
assemblies, while the full network path is stored for server-based
assemblies, as

For your scenario, there may be some solutions. Please refer to the
following link for all existing good ways:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/
tdlg_ch4.asp
The information in this link helps you:
Manage dependencies and references between projects and solutions.
Work with dependencies on .NET assemblies, Web services, databases,
serviced components, and COM Interop libraries.

Hope that helps.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! šC www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
-http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.as
p&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
Yan-Hong Huang[MSFT]
2004-10-07 01:29:41 UTC
Permalink
Hi Gerry,

Do you have any more concerns on this issue? If there is any unclear on the
materials that I posted, please feel free to reply here. We are closely
monitoring the issue thread.

Thanks very much.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! šC www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
-http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.as
p&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
Loading...