Mar*_* Ba 59 .net msbuild copy-local visual-studio msbuild-projectreference
TL; DR是否有任何官方文档详细描述<private>
/"复制本地"选项如何与MSBuild一起使用?应该考虑什么价值?
当你添加一个项目引用从一个项目在Visual Studio中的另一个,它会加入<ProjectReference Include=".....csproj">
到.csproj
的MSBuild文件.
当您将 Visual Studio中的一个项目的文件引用添加到文件系统中的程序集文件时,它将添加<Reference Include="Foo"> <HintPath>....Foo.dll</HintPath> ...
到.csproj
MSBuild文件.
在这两种情况下,Visual Studio的设置Copy Local = True|False
,一个子元素<Private>True</Private>
或<Private>False</Private>
将增加.
Reference
并且ProjectReference
似乎在Common MSBuild Project Items下记录:
Run Code Online (Sandbox Code Playgroud)<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
你会注意到,
ProjectReference
根本不记录该<private>
项目Reference
没有列出 True
或False
作为可能的值.所以.咦?是否有任何官方文档(我会对一篇好的博客文章感到满意)详细描述该<private>
选项的工作原理?这些医生是错误的还是还有更多的东西?
来自我的VS 2013 Express的示例代码段:
...
<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>
...
Run Code Online (Sandbox Code Playgroud)
小智 19
对于Reference和ProjectReference项,Private的可接受值为:True或False
msbuild中的此属性与VS中的项目引用属性对应为Copy Local.
我通过在VS中手动设置参考属性并查看xml得到了上述答案.我找不到私有项元数据的官方文档.
检查文档位于https://msdn.microsoft.com/en-us/library/bb629388.aspx,显示可接受的值为Never,Always和PreserveNewest.这些似乎是错误的,仅适用于CopyLocal元数据,该元数据用于Content,None和其他文件项.
归档时间: |
|
查看次数: |
22895 次 |
最近记录: |