I saw this in a project file the other day:
<ProjectReference Include="Foo\Bar\Baz.csproj">
<Project>{A GUID HERE}</Project>
<Name>Baz</Name>
<Private>False</Private> <!-- ??? -->
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
</ProjectReference>
Every node in a ProjectReference
appears to be self explanatory (the referenced project file, GUID, name to show in the solution explorer, and whether or not the current project should link to the referenced project) except Private
, and the Common MSBuild Project Items page doesn't document this value. (There's a Private
setting documented for Reference
rather than ProjectReference
— but it has Never
, Always
, and PreserveNewest
settings, not true and false)
What does this setting do?
Best Answer
The
Private
tag maintains the user-override to the "Copy Local" checkbox in the Visual Studio References folder. This controls whether the reference is used from the GAC or whether it will copy the referenced assembly to the build directory.While I cannot find any MSDN documentation to this effect (quelle surprise), it is evident from behavior and from the comment inMicrosoft.Common.CurrentVersion.targets:1742
where it is applied:This is documented in MSDN > Common MSBuild project items, and is evident from behavior and from the comment in
Microsoft.Common.CurrentVersion.targets:1742
where it is applied: