Skip to content

Commit 4a7a492

Browse files
committed
Call out error when @(BuildMetadata) changes too late
1 parent dc12ff8 commit 4a7a492

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Nerdbank.GitVersioning.Tasks/build/Nerdbank.GitVersioning.targets

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@
7979
<NBGV_GlobalPropertiesToRemove Include="RuntimeIdentifier" />
8080
<NBGV_GlobalPropertiesToRemove Include="Configuration" />
8181
<NBGV_GlobalPropertiesToRemove Include="Platform" />
82+
83+
<_BuildMetadataSnapped Include="@(BuildMetadata)" />
8284
</ItemGroup>
8385

8486
<ItemGroup>
@@ -97,6 +99,8 @@
9799
</ItemGroup>
98100

99101
<Target Name="GetBuildVersion" Returns="$(BuildVersion)">
102+
<Error Text="BuildMetadata items changed after a copy was made. Add all BuildMetadata items before importing this file." Condition=" '@(BuildMetadata)' != '@(_BuildMetadataSnapped)' " />
103+
100104
<!-- Calculate version by invoking another "project" with global properties that will serve as a key
101105
into an msbuild cache to ensure we only invoke the GetBuildVersion task as many times as will produce a unique value. -->
102106
<MSBuild Projects="@(ProjectReference)"

0 commit comments

Comments
 (0)