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?
Asked
Active
Viewed 7,894 times
6
-
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
– tofutim Mar 12 '13 at 00:36... as set from the IDE. When I move this to the main .csproj, the reference paths are not picked up.
2 Answers
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
-
This is also useful if you want different reference paths for different build configs – Chaholl Jul 28 '17 at 15:01
-
2This should be marked as the answer. HintPaths are pretty useless in a professional environment. – Bent Tranberg Jun 01 '18 at 12:59
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