none
Issue with VS2005 and C++ Managed code - Originally posted in another forum but moved here by request RRS feed

  • Question

  •  

    I am having problems with the assembly references with VS2005 and Managed C++ projects.  My solution has both C# and managed C++ projects.  The C# projects look at the paths detailed in the registry keys under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders.  However the C++ projects do not, and seem to only refer to the RelativePath setting.  This setting is not available to the user in the Studio and therefore causes a problem for me.  The reason why is due to different installation configurations we have from different teams of developers.  Currently, when adding a reference the RelativePath is hardcoded to that person's DLL location, however if that dll happens to be under their username for instance, the next person to open the project will not locate that dll.

     

    This is the culprit in the vcproj file.

     

      <AssemblyReference
       RelativePath="..\..\..\..\Program Files\My Sdk\Bin\MyDll.dll"
       AssemblyName="MyDll, Version=1.0.0.0, processorArchitecture=XXX"
       CopyLocalDependencies="false"
       UseDependenciesInBuild="false"
       CopyLocalSatelliteAssemblies="false"
      />

     

    The only way I have found to fix this problem is to manually change the path in a text editor like so:

     

      <AssemblyReference
       RelativePath="$(MYDLL_HOME)\Bin\MyDll.dll"
       AssemblyName="MyDll, Version=1.0.0.0, processorArchitecture=XXX"
       CopyLocalDependencies="false"
       UseDependenciesInBuild="false"
       CopyLocalSatelliteAssemblies="false"
      />

     

    This way your %MYDLL_HOME% environment variable can point to any location you like and the references will be found.  The only problem with this is that the next person to do a modification the the project, this variable will be resolved and replaced by the hardcoded path to that specific machine and break all other machines.

     

    Is there another way around this?  Is this indeed a bug?  I have tried the #using statement, the registry keys, the /AI option, and the lipath to no avail.  Please help!

     

    Thanks,

    Adam

     

    On a side note, how come we can no longer use environment variables in the output paths and other fields?  Also, when adding references to a C++ project, you can only add one at a time instead of being able to highlight as many as you need like with the C# projects?  This is very time consuming and frustrating to use.

    Friday, November 2, 2007 1:49 PM