MSBuild ProjectReference项目文档 [英] MSBuild ProjectReference item documentation

查看:180
本文介绍了MSBuild ProjectReference项目文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MSBuild项目中找不到有关ProjectReference标记的文档.在哪里可以找到它的详细说明?

I cannot find documentation about ProjectReference tag in MSBuild projects. Where can I read detailed description of it?

修改: 我有一个由其他人创建的.vcxproj.它包含ProjectReference项目. ProjectReference包含子标签:PrivateReferenceOutputAssemblyCopyLocalSatelliteAssembliesLinkLibraryDependenciesUseLibraryDependencyInputs.在哪里可以看到这些标签?它们可以包含哪些值? ProjectReference还可以包含哪些其他子标签?

I have a .vcxproj created by others. It contains ProjectReference item. ProjectReference contains subtags: Private, ReferenceOutputAssembly, CopyLocalSatelliteAssemblies, LinkLibraryDependencies, UseLibraryDependencyInputs. Where I can read about those tags? Which values can they contain? What other subtags can ProjectReference contain?

我在MSDN和Google中进行过搜索,但没有找到文档页面,只有关于其他产品的讨论和文档,而没有找到MSBuild.

I have searched in MSDN and Google but have not found documentation pages, only discussions and documentation about other products, not MSBuild.

推荐答案

从Jason Pyeron在其评论中提供的MSBuild源代码链接开始,我了解到,当MSBuild准备构建依赖项时,

Starting from the MSBuild source code links that Jason Pyeron provided in his comment, I learned that when MSBuild prepares build dependencies, it includes all item metadata (what you refer to as subtags) from each ProjectReference item. As a result, downstream Tasks and Targets can and sometimes do read arbitrary ProjectReference metadata.

有关C ++项目问题的答案,可以检查Microsoft.CppBuild.targetsMicrosoft.CppCommon.targets(与Visual Studio 2015一致的MSBuild 14中的默认路径是C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\).但是,如下面的示例所示,这样做并不简单:

For answers to your questions about C++ projects, you can examine Microsoft.CppBuild.targets and Microsoft.CppCommon.targets (their default path in MSBuild 14, coinciding with Visual Studio 2015, is C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\). As the following example shows, however, it is not simple to do so:

  1. Microsoft.CppBuild.targets中,目标ResolvedXDCMake动态创建_ResolvedNativeProjectReferencePaths项目.
  2. 目标ComputeReferenceLinkInputs从这些项目中动态创建ProjectReferenceToLink个项目.
  3. 对于每个没有CopyLocal元数据的项目,同一目标服务器将其添加,复制任何Private元数据值.
  4. 对于每个具有不同路径的项目,相同的目标会动态创建一个Link项目.
  5. 现在切换到Microsoft.CppCommon.targets,将在Link目标中Link任务的Sources参数中传递Link项!尽管很公平,但它们的元数据已在上一步中清除,因此在这种情况下,您不必深入研究Link Target文档.
  1. In Microsoft.CppBuild.targets, the Target ResolvedXDCMake creates _ResolvedNativeProjectReferencePaths Items dynamically.
  2. From those Items, the Target ComputeReferenceLinkInputs creates ProjectReferenceToLink items dynamically.
  3. For each of those Items that do not have CopyLocal metadata, the same Target adds it, copying any Private metadata value.
  4. For each those Items with a distinct path, the same target creates a Link item dynamically.
  5. Switching now to Microsoft.CppCommon.targets, Link items are passed in the Sources parameter of the Link Task in the Link Target! Although to be fair, their metadata was cleared in the previous step, so you do not have to dive into the Link Target documentation in this particular case.

以下是与您的问题相关的其他部分:

Here are additional portions that relate your question:

参数

  • Include(属性):项目文件的路径
  • Project(元数据):Project GUID,格式为{00000000-0000-0000-0000-000000000000}
  • ReferenceOutputAssembly(元数据):布尔值,指定是否 所引用项目的输出应传递给编译器. 默认值为true.
  • SpecificVersion(元数据):是否应使用程序集的确切版本.
  • Targets(元数据):在参考项目中应建立的目标的分号分隔列表.默认值为$(ProjectReferenceBuildTargets)的值,默认值为空白,表示默认目标.
  • OutputItemType(元数据):向其发出目标输出的项目类型.默认为空.如果ReferenceOutputAssembly设置为"true"(默认),则目标输出将成为编译器的引用.
  • EmbedInteropTypes(元数据):可选布尔值.此参考文献中的类型是否需要嵌入到目标程序集中-仅互操作程序集
  • Include (attribute): Path to project file
  • Project (metadata): Project GUID, in the form {00000000-0000-0000-0000-000000000000}
  • ReferenceOutputAssembly (metadata): Boolean specifying whether the outputs of the project referenced should be passed to the compiler. Default is true.
  • SpecificVersion (metadata): Whether the exact version of the assembly should be used.
  • Targets (metadata): Semicolon-separated list of targets in the referenced projects that should be built. Default is the value of $(ProjectReferenceBuildTargets) whose default is blank, indicating the default targets.
  • OutputItemType (metadata): Item type to emit target outputs into. Default is blank. If ReferenceOutputAssembly is set to "true" (default) then target outputs will become references for the compiler.
  • EmbedInteropTypes (metadata): Optional boolean. Whether the types in this reference need to embedded into the target assembly - interop asemblies only

备注

使用OutputItemType参数时,可能适用其他参数(元数据).例如,当OutputItemType设置为Content时,可以使用CopyToOutputDirectory:

When the OutputItemType parameter is used, additional parameters (metadata) may be applicable. For example, when OutputItemType is set to Content, CopyToOutputDirectory can be used:

  • CopyToOutputDirectory(元数据):可选字符串.确定是否将文件复制到输出目录.值:NeverAlwaysPreserveNewest.

这篇关于MSBuild ProjectReference项目文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆