TL;DR Is there any official documentation that describes in detail how the <private>
/ "Copy Local" option works with MSBuild? And what values are supposed to go into it?
When you add a project reference from one project in Visual Studio to another, it will add a <ProjectReference Include=".....csproj">
to the .csproj
MSBuild file.
When you add a file reference from one project in Visual Studio to an assembly file in the file system, it will add a <Reference Include="Foo"> <HintPath>....Foo.dll</HintPath> ...
to the .csproj
MSBuild file.
In both cases, for the Visual Studio Setting Copy Local = True|False
, a sub-element <Private>True</Private>
or <Private>False</Private>
will be added.
Reference
and ProjectReference
seem to be documented under Common MSBuild Project Items:
<ProjectReference> Represents a reference to another project. Item Name Description ------------------------- Name ... Project ... Package ... <Reference> Represents an assembly (managed) reference in the project. Item Name Description -------------------------- HintPath Optional string. Relative or absolute path of the assembly. Name ... ... Private Optional string. Determines whether to copy the file to the output directory. Values are: 1. Never 2. Always 3. PreserveNewest
You will notice that,
ProjectReference
doesn't document the<private>
Item at allReference
does not listTrue
orFalse
as possible values.
So. Huh? Is there any official documentation (I'll be more than happy with a good blog entry) that describes in detail how the <private>
option works? Are the doc's just dead wrong or is there something more to it?
Example snippet from my VS 2013 Express here:
...
<ItemGroup>
<Reference Include="ClassLibrary2">
<HintPath>C:\Somewhere\ClassLibrary2.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
...
<ItemGroup>
<ProjectReference Include="..\ClassLibrary1\ClassLibrary1.csproj">
<Project>{861dd746-de2e-4961-94db-4bb5b05effe9}</Project>
<Name>ClassLibrary1</Name>
<Private>False</Private>
</ProjectReference>
...
private
modifier in source code. So, being efficient developers they changed the label in the VS UI and left the internal references as is. How many of us work on a system where a database column or code variable was "re-purposed" to contain some slightly different data but refactoring the name was never done? If you are not raising your hand you have never worked in an enterprise-level development shop! :-) – Istanbul