Skip to content

Commit 28df9e5

Browse files
committed
Flow NuGetPackageRoot even on non-Restore paths
1 parent 6534a64 commit 28df9e5

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

src/Microsoft.DotNet.Arcade.Sdk/tools/Build.proj

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
<_CommonProps Include="VCTargetsPath=$([MSBuild]::ValueOrDefault('$(VCTargetsPath)', '$([MSBuild]::GetVsInstallRoot())\Common7\IDE\VC\VCTargets\'))" Condition="'$(MSBuildRuntimeType)' != 'Core'"/>
134134
</ItemGroup>
135135

136-
<ItemGroup Condition="'$(Restore)' == 'true'">
136+
<ItemGroup>
137137
<_RestoreToolsProps Include="@(_CommonProps)"/>
138138
<_RestoreToolsProps Include="BaseIntermediateOutputPath=$(ArtifactsToolsetDir)Common"/>
139139
<_RestoreToolsProps Include="ExcludeRestorePackageImports=true"/>
@@ -150,28 +150,32 @@
150150
</ItemGroup>
151151

152152
<!--
153-
Restore built-in tools.
153+
Builds from the 'internal' project, and only those, can download the .net Runtime
154+
from a private location.
155+
-->
156+
<ItemGroup Condition="'$(SYSTEM_TEAMPROJECT)' == 'internal'">
157+
<_RestoreToolsProps Include="DotNetRuntimeSourceFeed=$(DotNetRuntimeSourceFeed)"/>
158+
<_RestoreToolsProps Include="DotNetRuntimeSourceFeedKey=$(DotNetRuntimeSourceFeedKey)"/>
159+
</ItemGroup>
160+
161+
<!--
162+
Restore built-in tools if requested, and extract information from the NuGet restore output.
154163
-->
155164
<MSBuild Projects="Tools.proj"
156-
Targets="RestoreAndReturnNuGetPackageRoot"
165+
Targets="Restore"
157166
Properties="@(_RestoreToolsProps);_NETCORE_ENGINEERING_TELEMETRY=Restore"
158-
Condition="'$(Restore)' == 'true'">
167+
Condition="'$(Restore)' == 'true'"/>
168+
169+
<MSBuild Projects="Tools.proj"
170+
Targets="ReturnNuGetPackageRoot"
171+
Properties="@(_RestoreToolsProps);_NETCORE_ENGINEERING_TELEMETRY=ReturnNuGetPackageRoot">
159172
<Output TaskParameter="TargetOutputs" ItemName="_RestoreToolsOutput" />
160173
</MSBuild>
161174

162-
<ItemGroup Condition="'$(Restore)' == 'true'">
175+
<ItemGroup>
163176
<_CommonProps Include="@(_RestoreToolsOutput->'NuGetPackageRoot=%(Identity)')"/>
164177
</ItemGroup>
165178

166-
<!--
167-
Builds from the 'internal' project, and only those, can download the .net Runtime
168-
from a private location.
169-
-->
170-
<ItemGroup Condition="'$(SYSTEM_TEAMPROJECT)' == 'internal'">
171-
<_RestoreToolsProps Include="DotNetRuntimeSourceFeed=$(DotNetRuntimeSourceFeed)"/>
172-
<_RestoreToolsProps Include="DotNetRuntimeSourceFeedKey=$(DotNetRuntimeSourceFeedKey)"/>
173-
</ItemGroup>
174-
175179
<ItemGroup>
176180
<_PublishProps Include="@(_CommonProps)"/>
177181

src/Microsoft.DotNet.Arcade.Sdk/tools/Tools.proj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@
8686
Condition="'$(Restore)' == 'true'"/>
8787
</Target>
8888

89-
<Target Name="RestoreAndReturnNuGetPackageRoot" DependsOnTargets="Restore" Returns="$(NuGetPackageRoot)" />
89+
<Target Name="ReturnNuGetPackageRoot" Returns="$(NuGetPackageRoot)">
90+
<Error Text="Unable to determine 'NuGetPackageRoot' prior to restore." Condition="'$(NuGetPackageRoot)' == ''" />
91+
</Target>
9092

9193
<Import Project="SourceBuild/SourceBuildArcadeTools.targets" Condition="'$(ArcadeBuildFromSource)' == 'true' or
9294
'$(DotNetBuildRepo)' == 'true' or

0 commit comments

Comments
 (0)