6

I altered a bunch of project files in our solution, to add a reference path to all of them. I didn't realize that Reference Paths are stored in the .user file for the project. Is there a way to store those in the .csproj file, so they can be checked into source control?

Jonas
  • 4,454
  • 3
  • 37
  • 45
  • The .user file contains debug settings, not references. You'd better post an example of what you see. – Hans Passant Apr 27 '10 at 01:30
  • @Han, in my .csproj.user file, in addition to Publish history, I have ... as set from the IDE. When I move this to the main .csproj, the reference paths are not picked up. – tofutim Mar 12 '13 at 00:36

2 Answers2

8

You can edit the project file by hand and add <ReferencePath> inside the <PropertyGroup> tags.

The syntax in my case was

<ReferencePath>$(Codez)\z.Libraries\AutoCAD\2015;
$(Codez)\z.Libraries\AutoCAD\2015\inc-win32;
$(Codez)\z.Libraries\AutoCAD\2015\inc-x64</ReferencePath> 

where $Codez is an Environment variable I set myself and it obviously supports multiple paths. This is in VS2013.

CAD bloke
  • 8,578
  • 7
  • 65
  • 114
4

You might try adding the reference as a HintPath, like this:

<Reference Include="MyReference, Version=2.0.3.2, Culture=neutral, processorArchitecture=MSIL">     
  <HintPath>..\..\lib\Whatever\MyReference.dll</HintPath>
</Reference>
Neil
  • 7,227
  • 5
  • 42
  • 43
  • This is what I ended up doing, just deleting all of the reference paths, deleting the references, and re-adding the references pointing to the new location (which is what sets the HintPath). Thanks :) – Jonas Apr 27 '10 at 17:21
  • This is useful if you know what reference you are looking for. Having the reference path lets you pull dependencies from the reference path, which you can't quite do from the .csproj (at least I can't) – tofutim Mar 12 '13 at 00:38