Skip to content

Commit bc15604

Browse files
committed
Add property that can disable the private MSBuild task invocation
This allows Nerdbank.GitVersioning to (once again) work under quickbuild.
1 parent cb72788 commit bc15604

11 files changed

+147
-67
lines changed

src/NerdBank.GitVersioning.Tests/BuildIntegrationTests.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,25 @@ protected override void ApplyGlobalProperties(IDictionary<string, string> global
3939
=> globalProperties["NBGV_GitEngine"] = "Managed";
4040
}
4141

42+
[Trait("Engine", "Managed")]
43+
[Collection("Build")] // msbuild sets current directory in the process, so we can't have it be concurrent with other build tests.
44+
public class BuildIntegrationInProjectManagedTests : BuildIntegrationTests
45+
{
46+
public BuildIntegrationInProjectManagedTests(ITestOutputHelper logger)
47+
: base(logger)
48+
{
49+
}
50+
51+
protected override GitContext CreateGitContext(string path, string committish = null)
52+
=> GitContext.Create(path, committish, writable: false);
53+
54+
protected override void ApplyGlobalProperties(IDictionary<string, string> globalProperties)
55+
{
56+
globalProperties["NBGV_GitEngine"] = "Managed";
57+
globalProperties["NBGV_CacheMode"] = "None";
58+
}
59+
}
60+
4261
[Trait("Engine", "LibGit2")]
4362
[Collection("Build")] // msbuild sets current directory in the process, so we can't have it be concurrent with other build tests.
4463
public class BuildIntegrationLibGit2Tests : BuildIntegrationTests
@@ -57,6 +76,7 @@ protected override void ApplyGlobalProperties(IDictionary<string, string> global
5776

5877
public abstract class BuildIntegrationTests : RepoTestBase, IClassFixture<MSBuildFixture>
5978
{
79+
private const string GitVersioningPropsFileName = "NerdBank.GitVersioning.props";
6080
private const string GitVersioningTargetsFileName = "NerdBank.GitVersioning.targets";
6181
private const string UnitTestCloudBuildPrefix = "UnitTest: ";
6282
private static readonly string[] ToxicEnvironmentVariablePrefixes = new string[]
@@ -1175,6 +1195,7 @@ private ProjectRootElement CreateNativeProjectRootElement(string projectDirector
11751195
{
11761196
var pre = ProjectRootElement.Create(reader, this.projectCollection);
11771197
pre.FullPath = Path.Combine(projectDirectory, projectName);
1198+
pre.InsertAfterChild(pre.CreateImportElement(Path.Combine(this.RepoPath, GitVersioningPropsFileName)), null);
11781199
pre.AddImport(Path.Combine(this.RepoPath, GitVersioningTargetsFileName));
11791200
return pre;
11801201
}
@@ -1186,6 +1207,7 @@ private ProjectRootElement CreateProjectRootElement(string projectDirectory, str
11861207
{
11871208
var pre = ProjectRootElement.Create(reader, this.projectCollection);
11881209
pre.FullPath = Path.Combine(projectDirectory, projectName);
1210+
pre.InsertAfterChild(pre.CreateImportElement(Path.Combine(this.RepoPath, GitVersioningPropsFileName)), null);
11891211
pre.AddImport(Path.Combine(this.RepoPath, GitVersioningTargetsFileName));
11901212
return pre;
11911213
}

src/NerdBank.GitVersioning.Tests/NerdBank.GitVersioning.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<Compile Include="..\Shared\**\*.cs" LinkBase="Shared" />
1313
</ItemGroup>
1414
<ItemGroup>
15-
<EmbeddedResource Include="..\Nerdbank.GitVersioning.Tasks\build\*.targets">
15+
<EmbeddedResource Include="..\Nerdbank.GitVersioning.Tasks\build\*.targets;..\Nerdbank.GitVersioning.Tasks\build\*.props">
1616
<Visible>false</Visible>
1717
<Link>Targets\%(FileName)%(Extension)</Link>
1818
</EmbeddedResource>

src/Nerdbank.GitVersioning.Tasks/Nerdbank.GitVersioning.nuspec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,13 @@ IMPORTANT: The 3.x release may produce a different version height than prior maj
4848
<file src="$BaseOutputPath$netcoreapp3.1\System.Text.Json.dll" target="build\MSBuildCore\System.Text.Json.dll" />
4949
<file src="$BaseOutputPath$netcoreapp3.1\Validation.dll" target="build\MSBuildCore\Validation.dll" />
5050

51-
<file src="build\Nerdbank.GitVersioning.targets" target="build\Nerdbank.GitVersioning$LKGSuffix$.targets" />
51+
<file src="build\InProjectVersionComputation.targets" target="build\InProjectVersionComputation.targets" />
52+
<file src="build\MSBuildTargetCaching.targets" target="build\MSBuildTargetCaching.targets" />
5253
<file src="build\Nerdbank.GitVersioning.Common.targets" target="build\Nerdbank.GitVersioning.Common.targets" />
5354
<file src="build\Nerdbank.GitVersioning.Inner.targets" target="build\Nerdbank.GitVersioning.Inner.targets" />
55+
<file src="build\Nerdbank.GitVersioning.Inner.Empty.targets" target="build\Nerdbank.GitVersioning.Inner.Empty.targets" />
56+
<file src="build\Nerdbank.GitVersioning.props" target="build\Nerdbank.GitVersioning$LKGSuffix$.props" />
57+
<file src="build\Nerdbank.GitVersioning.targets" target="build\Nerdbank.GitVersioning$LKGSuffix$.targets" />
5458
<file src="buildCrossTargeting\Nerdbank.GitVersioning.targets" target="buildCrossTargeting\Nerdbank.GitVersioning$LKGSuffix$.targets" />
5559
<file src="readme.txt" target="readme.txt" />
5660
</files>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Import Project="Nerdbank.GitVersioning.Inner.targets"/>
3+
4+
<Target Name="SetPropertiesForInvokeGetBuildVersionTask">
5+
<!-- Set properties required for InvokeGetBuildVersionTask here, because
6+
CallTarget invoked targets do not see properties set by the calling target. -->
7+
<PropertyGroup>
8+
<BuildMetadata>@(BuildMetadata, ',')</BuildMetadata>
9+
</PropertyGroup>
10+
</Target>
11+
12+
<Target Name="InvokeGetBuildVersionTask" DependsOnTargets="SetPropertiesForInvokeGetBuildVersionTask">
13+
<CallTarget Targets="GetBuildVersion_Properties">
14+
<Output TaskParameter="TargetOutputs" ItemName="NBGV_PropertyItems" />
15+
</CallTarget>
16+
<CallTarget Targets="GetBuildVersion_CloudBuildVersionVars">
17+
<Output TaskParameter="TargetOutputs" ItemName="CloudBuildVersionVars" />
18+
</CallTarget>
19+
</Target>
20+
</Project>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<PropertyGroup>
3+
<NBGV_InnerGlobalProperties Condition=" '$(GitRepoRoot)' != '' ">$(NBGV_InnerGlobalProperties)GitRepoRoot=$(GitRepoRoot);</NBGV_InnerGlobalProperties>
4+
<NBGV_InnerGlobalProperties Condition=" '$(PublicRelease)' != '' ">$(NBGV_InnerGlobalProperties)PublicRelease=$(PublicRelease);</NBGV_InnerGlobalProperties>
5+
<NBGV_InnerGlobalProperties Condition=" '$(_NBGV_BuildingRef)' != '' ">$(NBGV_InnerGlobalProperties)_NBGV_BuildingRef=$(_NBGV_BuildingRef);</NBGV_InnerGlobalProperties>
6+
<NBGV_InnerGlobalProperties Condition=" '$(ProjectPathRelativeToGitRepoRoot)' != '' ">$(NBGV_InnerGlobalProperties)ProjectPathRelativeToGitRepoRoot=$(ProjectPathRelativeToGitRepoRoot);</NBGV_InnerGlobalProperties>
7+
<NBGV_InnerGlobalProperties Condition=" '$(GitVersionBaseDirectory)' != '' ">$(NBGV_InnerGlobalProperties)GitVersionBaseDirectory=$(GitVersionBaseDirectory);</NBGV_InnerGlobalProperties>
8+
<NBGV_InnerGlobalProperties Condition=" '$(OverrideBuildNumberOffset)' != '' ">$(NBGV_InnerGlobalProperties)OverrideBuildNumberOffset=$(OverrideBuildNumberOffset);</NBGV_InnerGlobalProperties>
9+
<NBGV_InnerGlobalProperties Condition=" '$(NBGV_CacheMode)' != '' ">$(NBGV_InnerGlobalProperties)NBGV_CacheMode=$(NBGV_CacheMode);</NBGV_InnerGlobalProperties>
10+
</PropertyGroup>
11+
12+
<!-- Compile a list of global properties that may vary when a project builds but that would never influence the result of the GetBuildVersion task. -->
13+
<ItemGroup>
14+
<NBGV_GlobalPropertiesToRemove Include="TargetFramework" />
15+
<NBGV_GlobalPropertiesToRemove Include="RuntimeIdentifier" />
16+
<NBGV_GlobalPropertiesToRemove Include="Configuration" />
17+
<NBGV_GlobalPropertiesToRemove Include="Platform" />
18+
19+
<_BuildMetadataSnapped Include="@(BuildMetadata)" />
20+
</ItemGroup>
21+
22+
<ItemGroup>
23+
<!-- Declare a P2P so that "msbuild -graph -isolate" doesn't complain when we use the MSBuild task to invoke our inner shared project. -->
24+
<ProjectReference Include="$(MSBuildThisFileDirectory)Nerdbank.GitVersioning.Inner.targets">
25+
<Targets>GetBuildVersion_Properties;GetBuildVersion_CloudBuildVersionVars</Targets>
26+
<Properties>$(NBGV_InnerGlobalProperties)BuildMetadata=@(BuildMetadata, ',');</Properties>
27+
<GlobalPropertiesToRemove>@(NBGV_GlobalPropertiesToRemove)</GlobalPropertiesToRemove>
28+
29+
<!-- Do our very best to prevent Microsoft.Common.CurrentVersion.targets or IDEs from processing this P2P. It's only here for MSBuild's static graph. -->
30+
<BuildReference>false</BuildReference>
31+
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
32+
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
33+
<Visible>false</Visible>
34+
<NBGV_InnerProject>true</NBGV_InnerProject>
35+
</ProjectReference>
36+
</ItemGroup>
37+
38+
<Target Name="InvokeGetBuildVersionTask">
39+
<Error Text="BuildMetadata items changed after a copy was made. Add all BuildMetadata items before importing this file." Condition=" '@(BuildMetadata)' != '@(_BuildMetadataSnapped)' " />
40+
41+
<!-- Calculate version by invoking another "project" with global properties that will serve as a key
42+
into an msbuild cache to ensure we only invoke the GetBuildVersion task as many times as will produce a unique value. -->
43+
<MSBuild Projects="@(ProjectReference)"
44+
Condition=" '%(ProjectReference.NBGV_InnerProject)' == 'true' "
45+
Properties="%(ProjectReference.Properties)"
46+
RemoveProperties="%(ProjectReference.GlobalPropertiesToRemove)"
47+
Targets="GetBuildVersion_Properties">
48+
<Output TaskParameter="TargetOutputs" ItemName="NBGV_PropertyItems" />
49+
</MSBuild>
50+
51+
<!-- Also get other items. -->
52+
<MSBuild Projects="@(ProjectReference)"
53+
Condition=" '%(ProjectReference.NBGV_InnerProject)' == 'true' "
54+
Properties="%(ProjectReference.Properties)"
55+
RemoveProperties="%(ProjectReference.GlobalPropertiesToRemove)"
56+
Targets="GetBuildVersion_CloudBuildVersionVars">
57+
<Output TaskParameter="TargetOutputs" ItemName="CloudBuildVersionVars" />
58+
</MSBuild>
59+
</Target>
60+
</Project>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
4+
<_NBGV_Common_Targets_Imported>true</_NBGV_Common_Targets_Imported>
45
<_NBGV_PlatformSuffix Condition=" '$(_NBGV_PlatformSuffix)' == '' and '$(MSBuildRuntimeType)' == 'Core' ">MSBuildCore/</_NBGV_PlatformSuffix>
56
<_NBGV_PlatformSuffix Condition=" '$(_NBGV_PlatformSuffix)' == '' ">MSBuildFull/</_NBGV_PlatformSuffix>
67
<NerdbankGitVersioningTasksPath Condition=" '$(NerdbankGitVersioningTasksPath)' == '' ">$(MSBuildThisFileDirectory)$(_NBGV_PlatformSuffix)</NerdbankGitVersioningTasksPath>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
3+
<!-- These targets are called by MSBuild static graph because we declare a ProjectReference item to this file. -->
4+
<Target Name="GetTargetFrameworks" />
5+
<Target Name="GetNativeManifest" />
6+
<Target Name="GetCopyToOutputDirectoryItems" />
7+
<Target Name="GetTargetFrameworksWithPlatformForSingleTargetFramework" />
8+
9+
</Project>

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33

4-
<Import Project="Nerdbank.GitVersioning.Common.targets"/>
4+
<Import Project="Nerdbank.GitVersioning.Common.targets" Condition=" '$(_NBGV_Common_Targets_Imported)' != 'true' "/>
55

66
<UsingTask AssemblyFile="$(NerdbankGitVersioningTasksPath)Nerdbank.GitVersioning.Tasks.dll" TaskName="Nerdbank.GitVersioning.Tasks.GetBuildVersion"/>
77

@@ -18,7 +18,7 @@
1818
BuildingRef="$(_NBGV_BuildingRef)"
1919
BuildMetadata="$(BuildMetadata.Replace(',',';'))"
2020
DefaultPublicRelease="$(PublicRelease)"
21-
ProjectDirectory="$(ProjectDirectory)"
21+
ProjectDirectory="$(GitVersionBaseDirectory)"
2222
GitRepoRoot="$(GitRepoRoot)"
2323
ProjectPathRelativeToGitRepoRoot="$(ProjectPathRelativeToGitRepoRoot)"
2424
OverrideBuildNumberOffset="$(OverrideBuildNumberOffset)"
@@ -42,11 +42,7 @@
4242
<Message Importance="low" Text="AssemblyInformationalVersion: $(AssemblyInformationalVersion)" />
4343
<Message Importance="low" Text="NuGetPackageVersion: $(NuGetPackageVersion)" />
4444
</Target>
45-
46-
<!-- These targets are called by MSBuild static graph because we declare a ProjectReference item to this file. -->
47-
<Target Name="GetTargetFrameworks" />
48-
<Target Name="GetNativeManifest" />
49-
<Target Name="GetCopyToOutputDirectoryItems" />
50-
<Target Name="GetTargetFrameworksWithPlatformForSingleTargetFramework" />
45+
46+
<Import Project="Nerdbank.GitVersioning.Inner.Empty.targets" Condition=" '$(NBGV_CacheMode)' == 'MSBuildTargetCaching' " />
5147

5248
</Project>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<PropertyGroup>
3+
<!-- Cache modes include:
4+
MSBuildTargetCaching
5+
This is the default.
6+
Versions will be computed by an MSBuild target which can be shared across an entire build session via MSBuild target output caching.
7+
None
8+
Every project will compute its own version.
9+
10+
Note that the choice in caching should have no bearing on the result of the versions computed - only on build perf and which systems it can work with.
11+
-->
12+
<NBGV_CacheMode Condition=" '$(NBGV_CacheMode)' == '' and '$(QBuild)' == '1' ">None</NBGV_CacheMode>
13+
<NBGV_CacheMode Condition=" '$(NBGV_CacheMode)' == '' ">MSBuildTargetCaching</NBGV_CacheMode>
14+
</PropertyGroup>
15+
</Project>

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

Lines changed: 6 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
2626
</PropertyGroup>
2727

28-
<Import Project="Nerdbank.GitVersioning.Common.targets"/>
28+
<Import Project="Nerdbank.GitVersioning.Common.targets" />
2929

3030
<UsingTask AssemblyFile="$(NerdbankGitVersioningTasksPath)Nerdbank.GitVersioning.Tasks.dll" TaskName="Nerdbank.GitVersioning.Tasks.AssemblyVersionInfo"/>
3131
<UsingTask AssemblyFile="$(NerdbankGitVersioningTasksPath)Nerdbank.GitVersioning.Tasks.dll" TaskName="Nerdbank.GitVersioning.Tasks.NativeVersionInfo"/>
@@ -37,7 +37,7 @@
3737
<PropertyGroup>
3838
<!-- $(TargetExt) isn't set at evaluation time for us when built in wpftmp.csproj with manual imports -->
3939
<!-- Suppress assembly version info generation if not obviously compiling an assembly. -->
40-
<GenerateAssemblyVersionInfo Condition=" '$(GenerateAssemblyVersionInfo)' == '' and '$(TargetExt)' != '.dll' and '$(TargetExt)' != '.exe'">false</GenerateAssemblyVersionInfo>
40+
<GenerateAssemblyVersionInfo Condition=" '$(GenerateAssemblyVersionInfo)' == '' and '$(TargetExt)' != '.dll' and '$(TargetExt)' != '.exe' ">false</GenerateAssemblyVersionInfo>
4141

4242
<!-- Workaround the property stomping that msbuild does (see https://github.com/microsoft/msbuild/pull/4922) with manual imports. -->
4343
<PrepareForBuildDependsOn>
@@ -64,54 +64,9 @@
6464
<_NBGV_BuildingRef Condition=" '$(_NBGV_BuildingRef)' == '' ">$(_NBGV_BuildingBranch)</_NBGV_BuildingRef>
6565

6666
<GitVersionBaseDirectory Condition=" '$(GitVersionBaseDirectory)' == '' ">$(MSBuildProjectDirectory)</GitVersionBaseDirectory>
67-
<NBGV_InnerGlobalProperties Condition=" '$(GitRepoRoot)' != '' ">$(NBGV_InnerGlobalProperties)GitRepoRoot=$(GitRepoRoot);</NBGV_InnerGlobalProperties>
68-
<NBGV_InnerGlobalProperties Condition=" '$(PublicRelease)' != '' ">$(NBGV_InnerGlobalProperties)PublicRelease=$(PublicRelease);</NBGV_InnerGlobalProperties>
69-
<NBGV_InnerGlobalProperties Condition=" '$(_NBGV_BuildingRef)' != '' ">$(NBGV_InnerGlobalProperties)_NBGV_BuildingRef=$(_NBGV_BuildingRef);</NBGV_InnerGlobalProperties>
70-
<NBGV_InnerGlobalProperties Condition=" '$(ProjectPathRelativeToGitRepoRoot)' != '' ">$(NBGV_InnerGlobalProperties)ProjectPathRelativeToGitRepoRoot=$(ProjectPathRelativeToGitRepoRoot);</NBGV_InnerGlobalProperties>
71-
<NBGV_InnerGlobalProperties Condition=" '$(GitVersionBaseDirectory)' != '' ">$(NBGV_InnerGlobalProperties)ProjectDirectory=$(GitVersionBaseDirectory);</NBGV_InnerGlobalProperties>
72-
<NBGV_InnerGlobalProperties Condition=" '$(OverrideBuildNumberOffset)' != '' ">$(NBGV_InnerGlobalProperties)OverrideBuildNumberOffset=$(OverrideBuildNumberOffset);</NBGV_InnerGlobalProperties>
73-
<NBGV_CoreTargets>$(MSBuildThisFileDirectory)Nerdbank.GitVersioning.Inner.targets</NBGV_CoreTargets>
7467
</PropertyGroup>
7568

76-
<!-- Compile a list of global properties that may vary when a project builds but that would never influence the result of the GetBuildVersion task. -->
77-
<ItemGroup>
78-
<NBGV_GlobalPropertiesToRemove Include="TargetFramework" />
79-
<NBGV_GlobalPropertiesToRemove Include="RuntimeIdentifier" />
80-
<NBGV_GlobalPropertiesToRemove Include="Configuration" />
81-
<NBGV_GlobalPropertiesToRemove Include="Platform" />
82-
83-
<_BuildMetadataSnapped Include="@(BuildMetadata)" />
84-
</ItemGroup>
85-
86-
<ItemGroup>
87-
<!-- Declare a P2P so that "msbuild -graph -isolate" doesn't complain when we use the MSBuild task to invoke our inner shared project. -->
88-
<ProjectReference Include="$(NBGV_CoreTargets)">
89-
<Targets>GetBuildVersion_Properties;GetBuildVersion_CloudBuildVersionVars</Targets>
90-
<Properties>$(NBGV_InnerGlobalProperties)BuildMetadata=@(BuildMetadata, ',');</Properties>
91-
<GlobalPropertiesToRemove>@(NBGV_GlobalPropertiesToRemove)</GlobalPropertiesToRemove>
92-
93-
<!-- Do our very best to prevent Microsoft.Common.CurrentVersion.targets or IDEs from processing this P2P. It's only here for MSBuild's static graph. -->
94-
<BuildReference>false</BuildReference>
95-
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
96-
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
97-
<Visible>false</Visible>
98-
<NBGV_InnerProject>true</NBGV_InnerProject>
99-
</ProjectReference>
100-
</ItemGroup>
101-
102-
<Target Name="GetBuildVersion" Returns="$(BuildVersion)">
103-
<Error Text="BuildMetadata items changed after a copy was made. Add all BuildMetadata items before importing this file." Condition=" '@(BuildMetadata)' != '@(_BuildMetadataSnapped)' " />
104-
105-
<!-- Calculate version by invoking another "project" with global properties that will serve as a key
106-
into an msbuild cache to ensure we only invoke the GetBuildVersion task as many times as will produce a unique value. -->
107-
<MSBuild Projects="@(ProjectReference)"
108-
Condition=" '%(ProjectReference.NBGV_InnerProject)' == 'true' "
109-
Properties="%(ProjectReference.Properties)"
110-
RemoveProperties="%(ProjectReference.GlobalPropertiesToRemove)"
111-
Targets="GetBuildVersion_Properties">
112-
<Output TaskParameter="TargetOutputs" ItemName="NBGV_PropertyItems" />
113-
</MSBuild>
114-
69+
<Target Name="GetBuildVersion" Returns="$(BuildVersion)" DependsOnTargets="InvokeGetBuildVersionTask">
11570
<!-- Convert each task item into a bona fide MSBuild property. -->
11671
<CreateProperty
11772
Value="%(NBGV_PropertyItems.Value)"
@@ -123,17 +78,11 @@
12378
<PropertyGroup>
12479
<CloudBuildNumber Condition=" '$(CloudBuildNumber)' == '' and %(NBGV_PropertyItems.Identity) == 'CloudBuildNumber' ">%(Value)</CloudBuildNumber>
12580
</PropertyGroup>
126-
127-
<!-- Also get other items. -->
128-
<MSBuild Projects="@(ProjectReference)"
129-
Condition=" '%(ProjectReference.NBGV_InnerProject)' == 'true' "
130-
Properties="%(ProjectReference.Properties)"
131-
RemoveProperties="%(ProjectReference.GlobalPropertiesToRemove)"
132-
Targets="GetBuildVersion_CloudBuildVersionVars">
133-
<Output TaskParameter="TargetOutputs" ItemName="CloudBuildVersionVars" />
134-
</MSBuild>
13581
</Target>
13682

83+
<Import Project="InProjectVersionComputation.targets" Condition=" '$(NBGV_CacheMode)' != 'MSBuildTargetCaching' "/>
84+
<Import Project="MSBuildTargetCaching.targets" Condition=" '$(NBGV_CacheMode)' == 'MSBuildTargetCaching' "/>
85+
13786
<Target Name="SetCloudBuildVersionVars"
13887
DependsOnTargets="GetBuildVersion"
13988
AfterTargets="GetBuildVersion"

0 commit comments

Comments
 (0)