Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<LibGit2SharpNativeVersion>2.0.315-alpha.0.9</LibGit2SharpNativeVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="all" />
<PackageReference Include="Nullable" Version="1.3.1" PrivateAssets="all" />
<!-- Use the Unstable package ID so that update tools will help us keep it current even though it seems to be ever-unstable lately. -->
Expand Down
25 changes: 14 additions & 11 deletions src/Nerdbank.GitVersioning.Tasks/build/MSBuildTargetCaching.targets
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
</ItemGroup>

<ItemGroup>
<!-- Declare a P2P so that "msbuild -graph -isolate" doesn't complain when we use the MSBuild task to invoke our inner shared project. -->
<ProjectReference Include="$(NBGV_CachingProjectReference)">
<NBGV_CachingProjectReference Include="$(NBGV_CachingProjectReference)">
<Targets>GetBuildVersion_Properties;GetBuildVersion_CloudBuildVersionVars</Targets>
<Properties>$(NBGV_InnerGlobalProperties)BuildMetadata=@(BuildMetadata, ',');</Properties>
<SetConfiguration>Configuration=Release</SetConfiguration>
Expand All @@ -31,8 +30,14 @@
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
<Visible>false</Visible>
<NBGV_InnerProject>true</NBGV_InnerProject>
<PrivateAssets>all</PrivateAssets>
</NBGV_CachingProjectReference>

<!-- Declare a P2P so that "msbuild -graph -isolate" doesn't complain when we use the MSBuild task to invoke our inner shared project.
This causes a lot of problems (https://github.com/dotnet/Nerdbank.GitVersioning/issues?q=label%3Amsbuild-p2p+) with projects
that expect to understand all their own ProjectReferences though, so only define it when the user is running a graph build. -->
<ProjectReference Include="@(NBGV_CachingProjectReference)" Condition="'$(IsGraphBuild)'=='true'">
<NBGV_InnerProject>true</NBGV_InnerProject>
</ProjectReference>
</ItemGroup>

Expand All @@ -41,19 +46,17 @@

<!-- Calculate version by invoking another "project" with global properties that will serve as a key
into an msbuild cache to ensure we only invoke the GetBuildVersion task as many times as will produce a unique value. -->
<MSBuild Projects="@(ProjectReference)"
Condition=" '%(ProjectReference.NBGV_InnerProject)' == 'true' "
Properties="%(ProjectReference.Properties)"
RemoveProperties="%(ProjectReference.GlobalPropertiesToRemove)"
<MSBuild Projects="@(NBGV_CachingProjectReference)"
Properties="%(NBGV_CachingProjectReference.Properties)"
RemoveProperties="%(NBGV_CachingProjectReference.GlobalPropertiesToRemove)"
Targets="GetBuildVersion_Properties">
<Output TaskParameter="TargetOutputs" ItemName="NBGV_PropertyItems" />
</MSBuild>

<!-- Also get other items. -->
<MSBuild Projects="@(ProjectReference)"
Condition=" '%(ProjectReference.NBGV_InnerProject)' == 'true' "
Properties="%(ProjectReference.Properties)"
RemoveProperties="%(ProjectReference.GlobalPropertiesToRemove)"
<MSBuild Projects="@(NBGV_CachingProjectReference)"
Properties="%(NBGV_CachingProjectReference.Properties)"
RemoveProperties="%(NBGV_CachingProjectReference.GlobalPropertiesToRemove)"
Targets="GetBuildVersion_CloudBuildVersionVars">
<Output TaskParameter="TargetOutputs" ItemName="CloudBuildVersionVars" />
</MSBuild>
Expand Down