.NET Forum / Visual Studio.NET / IDE / October 2004
why relative hint path but absolute reference path
|
|
Thread rating:  |
gerry - 22 Sep 2004 15:12 GMT 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" - 23 Sep 2004 07:55 GMT Hi 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
 Signature Get Secure! - www.microsoft.com/security This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
gerry - 23 Sep 2004 18:31 GMT 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.
> Hi gerry, > [quoted text clipped - 20 lines] > This posting is provided "AS IS" with no warranties, and confers no rights. > -------------------- "Gary Chang" - 24 Sep 2004 07:48 GMT Hi gerry,
> 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.
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
 Signature Get Secure! - www.microsoft.com/security This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
"Gary Chang" - 27 Sep 2004 03:08 GMT 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
 Signature Get Secure! - www.microsoft.com/security This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
gerry - 28 Sep 2004 00:32 GMT basically , we are forced to re-add the dll reference when the solution is moved/copied/passed around.
> Hi gerry, > [quoted text clipped - 11 lines] > This posting is provided "AS IS" with no warranties, and confers no rights. > -------------------- "Gary Chang" - 29 Sep 2004 10:00 GMT Thanks for your response, 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
 Signature Get Secure! - www.microsoft.com/security This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
"Gary Chang" - 30 Sep 2004 09:57 GMT 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
 Signature Get Secure! - www.microsoft.com/security This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
gerry - 30 Sep 2004 15:58 GMT 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
> Hi gerry, > [quoted text clipped - 31 lines] > This posting is provided "AS IS" with no warranties, and confers no rights. > -------------------- Yan-Hong Huang[MSFT] - 05 Oct 2004 08:02 GMT 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] - 07 Oct 2004 02:29 GMT 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.
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|