I have a C# solution contains many projects. Each project references some dlls in a specified folder. According to MSDN we could add the reference path for a project in project -> Properties -> Reference Paths. It will generate a .csproj.user file under the project folder with the content below:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ReferencePath>C:\References\bin\</ReferencePath>
</PropertyGroup>
</Project>
But this only works for one project alone. Is there a simple way to apply the same setting to all of the projects in the solution?
If you now view the properties for Project B, notice that the Reference Path property setting contains an entry that is the full path to the Project A Bin directory. The Reference Path property tells Visual Studio where to look for referenced assemblies; the default is the path you used when you added the reference.
Add a reference Reference Manager opens and lists the available references by group. Select a reference to add, and then select OK. If you don't see the reference you're looking for, select Browse to locate the reference. (If you're developing C++ projects, you might not see a browse option.)
You can also right-click the project node and select Add > Project Reference. If you see a References node in Solution Explorer, you can use the right-click context menu to choose Add Reference. Or, right-click the project node and select Add > Reference.
Complete the following steps to add an assembly reference in Microsoft Visual Studio. Select the project in the Solution Explorer. Select Project»Add Reference to launch the Add Reference dialog box.
I found a blog post explaining how to do this.
Open the Package Manager Console (e.g. View | Other Windows | Package Manager Console) and use a script such as the following for relative paths:
$path = [System.IO.Path]; foreach ($proj in get-project -all) {$proj.Properties.Item("ReferencePath").Value="$($path::GetDirectoryName($proj.filename))\..\libs"}
or this for a single fixed project reference for all projects:
foreach ($proj in get-project -all) {$proj.Properties.Item("ReferencePath").Value="C:\lib"}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With