MSBuild ProjectReference项目文档 [英] MSBuild ProjectReference item documentation
问题描述
我在MSBuild项目中找不到有关ProjectReference
标记的文档.在哪里可以找到它的详细说明?
I cannot find documentation about ProjectReference
tag in MSBuild projects. Where can I read detailed description of it?
修改:
我有一个由其他人创建的.vcxproj
.它包含ProjectReference
项目. ProjectReference
包含子标签:Private
,ReferenceOutputAssembly
,CopyLocalSatelliteAssemblies
,LinkLibraryDependencies
,UseLibraryDependencyInputs
.在哪里可以看到这些标签?它们可以包含哪些值? 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.targets
和Microsoft.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:
- 在
Microsoft.CppBuild.targets
中,目标ResolvedXDCMake
动态创建_ResolvedNativeProjectReferencePaths
项目. - 目标
ComputeReferenceLinkInputs
从这些项目中动态创建ProjectReferenceToLink
个项目. - 对于每个没有
CopyLocal
元数据的项目,同一目标服务器将其添加,复制任何Private
元数据值. - 对于每个具有不同路径的项目,相同的目标会动态创建一个
Link
项目. - 现在切换到
Microsoft.CppCommon.targets
,将在Link
目标中Link
任务的Sources
参数中传递Link
项!尽管很公平,但它们的元数据已在上一步中清除,因此在这种情况下,您不必深入研究Link
Target文档.
- In
Microsoft.CppBuild.targets
, the TargetResolvedXDCMake
creates_ResolvedNativeProjectReferencePaths
Items dynamically. - From those Items, the Target
ComputeReferenceLinkInputs
createsProjectReferenceToLink
items dynamically. - For each of those Items that do not have
CopyLocal
metadata, the same Target adds it, copying anyPrivate
metadata value. - For each those Items with a distinct path, the same target creates a
Link
item dynamically. - Switching now to
Microsoft.CppCommon.targets
,Link
items are passed in theSources
parameter of theLink
Task in theLink
Target! Although to be fair, their metadata was cleared in the previous step, so you do not have to dive into theLink
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 fileProject
(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. IfReferenceOutputAssembly
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(元数据):可选字符串.确定是否将文件复制到输出目录.值:
Never
,Always
,PreserveNewest
.
这篇关于MSBuild ProjectReference项目文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!