Groups | Blog | Home
all groups > visual studio .net ide > september 2004 >

visual studio .net ide : why relative hint path but absolute reference path


gerry
9/22/2004 10:12:16 AM
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





v-garych NO[at]SPAM online.microsoft.com (
9/23/2004 6:55:19 AM
Hi gerry,

[quoted text, click to view]

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
9/23/2004 1:31:16 PM
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.



[quoted text, click to view]

v-garych NO[at]SPAM online.microsoft.com (
9/24/2004 6:48:53 AM
Hi gerry,

[quoted text, click to view]

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.
--------------------
v-garych NO[at]SPAM online.microsoft.com (
9/27/2004 2:08:07 AM
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
9/27/2004 7:32:09 PM
basically , we are forced to re-add the dll reference when the solution is
moved/copied/passed around.




[quoted text, click to view]

v-garych NO[at]SPAM online.microsoft.com (
9/29/2004 9:00:34 AM
Thanks for your response, gerry,

[quoted text, click to view]

... 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.
--------------------
v-garych NO[at]SPAM online.microsoft.com (
9/30/2004 8:57:17 AM
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
9/30/2004 10:58:29 AM
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


[quoted text, click to view]

yhhuang NO[at]SPAM online.microsoft.com
10/5/2004 7:02:18 AM
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.
yhhuang NO[at]SPAM online.microsoft.com
10/7/2004 1:29:41 AM
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.
AddThis Social Bookmark Button