Tôi muốn cấu hình và tinh chỉnh xây dựng của chúng tôi hy vọng sẽ tiết kiệm vài giây ở đây và ở đó. Tôi đã có thể tạo ra một nhiệm vụ mà xuất phát từ ResolveAssemblyReferences và sử dụng nó thay vào đó, nhưng tôi đang gặp vấn đề trong việc tìm hiểu những điều sau đây (từ Microsoft.Common.targets):ResolveProjectReferences hoạt động như thế nào?
<!--
============================================================
ResolveProjectReferences
Build referenced projects:
[IN]
@(NonVCProjectReference) - The list of non-VC project references.
[OUT]
@(_ResolvedProjectReferencePaths) - Paths to referenced projects.
============================================================
-->
<Target
Name="ResolveProjectReferences"
DependsOnTargets="SplitProjectReferencesByType;_SplitProjectReferencesByFileExistence">
<!--
When building this project from the IDE or when building a .SLN from the command-line,
just gather the referenced build outputs. The code that builds the .SLN will already have
built the project, so there's no need to do it again here.
The ContinueOnError setting is here so that, during project load, as
much information as possible will be passed to the compilers.
-->
<MSBuild
Projects="@(_MSBuildProjectReferenceExistent)"
Targets="GetTargetPath"
BuildInParallel="$(BuildInParallel)"
UnloadProjectsOnCompletion="$(UnloadProjectsOnCompletion)"
Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration); %(_MSBuildProjectReferenceExistent.SetPlatform)"
Condition="'@(NonVCProjectReference)'!='' and ('$(BuildingSolutionFile)' == 'true' or '$(BuildingInsideVisualStudio)' == 'true' or '$(BuildProjectReferences)' != 'true') and '@(_MSBuildProjectReferenceExistent)' != ''"
ContinueOnError="!$(BuildingProject)">
<Output TaskParameter="TargetOutputs" ItemName="_ResolvedProjectReferencePaths"/>
</MSBuild>
<!--
Build referenced projects when building from the command line.
The $(ProjectReferenceBuildTargets) will normally be blank so that the project's default
target is used during a P2P reference. However if a custom build process requires that
the referenced project has a different target to build it can be specified.
-->
<MSBuild
Projects="@(_MSBuildProjectReferenceExistent)"
Targets="$(ProjectReferenceBuildTargets)"
BuildInParallel="$(BuildInParallel)"
UnloadProjectsOnCompletion="$(UnloadProjectsOnCompletion)"
Condition="'@(NonVCProjectReference)'!='' and '$(BuildingInsideVisualStudio)' != 'true' and '$(BuildingSolutionFile)' != 'true' and '$(BuildProjectReferences)' == 'true' and '@(_MSBuildProjectReferenceExistent)' != ''">
<Output TaskParameter="TargetOutputs" ItemName="_ResolvedProjectReferencePaths"/>
</MSBuild>
<!--
Get manifest items from the (non-exe) built project references (to feed them into ResolveNativeReference).
-->
<MSBuild
Projects="@(_MSBuildProjectReferenceExistent)"
Targets="GetNativeManifest"
BuildInParallel="$(BuildInParallel)"
UnloadProjectsOnCompletion="$(UnloadProjectsOnCompletion)"
Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration); %(_MSBuildProjectReferenceExistent.SetPlatform)"
Condition="'@(NonVCProjectReference)'!='' and '$(BuildingProject)'=='true' and '@(_MSBuildProjectReferenceExistent)'!=''">
<Output TaskParameter="TargetOutputs" ItemName="NativeReference"/>
</MSBuild>
<!-- Issue a warning for each non-existent project. -->
<Warning
Text="The referenced project '%(_MSBuildProjectReferenceNonexistent.Identity)' does not exist."
Condition="'@(NonVCProjectReference)'!='' and '@(_MSBuildProjectReferenceNonexistent)'!=''"/>
</Target>
Một số thông số được thông qua và một số được trả về nhưng công việc thực tế xảy ra ở đâu? Không có nhiều trên msdn - Tôi đã tìm thấy Microsoft.Build.Tasks.ResolveProjectBase, nhưng nó không được sử dụng nhiều.
Vì vậy, nếu nó chỉ ra rằng giai đoạn ResolveProjectReferences đang dành một lượng đáng kể thời gian trong quá trình xây dựng, đó là hiệu quả bởi vì dự án bị chặn, chờ đợi hoặc phụ thuộc được xây dựng? Tôi đã không thể tìm thấy bất kỳ tài liệu rõ ràng về điều này. Nó không rõ ràng nếu đây là thời gian để xác định và định vị phụ thuộc (công việc thực tế), hoặc thời gian chờ đợi phụ thuộc để có sẵn (thời gian nhàn rỗi hiệu quả) – jalf
Đặt cược tốt nhất của bạn là xây dựng ở mức độ Verbosity Chẩn đoán. Điều đó sẽ cho bạn thấy chính xác những gì mỗi mục tiêu đang làm (bao gồm các bản dựng lồng nhau) cũng như thời gian cho nhiều hoạt động. – tintoy