Skip to content

Commit 961b7d2

Browse files
authored
Remove SDK import from Tools.proj (#4111)
1 parent 0e00228 commit 961b7d2

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@
8282
<Error Text="Property 'RepoRoot' must be specified" Condition="'$(_RepoRootOriginal)' == ''"/>
8383
<Error Text="File 'global.json' must exist in directory specified by RepoRoot: '$(_RepoRootOriginal)'" Condition="'$(_RepoRootOriginal)' != '' and !Exists('$(RepoRoot)global.json')"/>
8484

85+
<PropertyGroup>
86+
<!-- IsRunningFromVisualStudio may be true even when running msbuild.exe from command line. This generally means that MSBUild is Visual Studio installation and therefore we need to find NuGet.targets in a different location. -->
87+
<_NuGetRestoreTargets>$(MSBuildToolsPath)\NuGet.targets</_NuGetRestoreTargets>
88+
<_NuGetRestoreTargets Condition="'$([MSBuild]::IsRunningFromVisualStudio())' == 'true'">$(MSBuildToolsPath32)\..\..\..\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.targets</_NuGetRestoreTargets>
89+
</PropertyGroup>
90+
8591
<ItemGroup>
8692
<_SolutionBuildTargets Include="Rebuild" Condition="'$(Rebuild)' == 'true'" />
8793
<_SolutionBuildTargets Include="Build" Condition="'$(Build)' == 'true' and '$(Rebuild)' != 'true'" />
@@ -123,6 +129,7 @@
123129
<_RestoreToolsProps Include="BaseIntermediateOutputPath=$(ArtifactsToolsetDir)Common"/>
124130
<_RestoreToolsProps Include="ExcludeRestorePackageImports=true"/>
125131
<_RestoreToolsProps Include="PublishingToBlobStorage=$(DotNetPublishToBlobFeed)"/>
132+
<_RestoreToolsProps Include="_NuGetRestoreTargets=$(_NuGetRestoreTargets)"/>
126133
</ItemGroup>
127134

128135
<ItemGroup>
@@ -164,10 +171,6 @@
164171
<PropertyGroup>
165172
<!-- This can be set to false as an optimization for repos that don't use NuGet. -->
166173
<RestoreUsingNuGetTargets Condition="'$(RestoreUsingNuGetTargets)' == ''">true</RestoreUsingNuGetTargets>
167-
168-
<!-- IsRunningFromVisualStudio may be true even when running msbuild.exe from command line. This generally means that MSBUild is Visual Studio installation and therefore we need to find NuGet.targets in a different location. -->
169-
<_NuGetRestoreTargets>$(MSBuildToolsPath)\NuGet.targets</_NuGetRestoreTargets>
170-
<_NuGetRestoreTargets Condition="'$([MSBuild]::IsRunningFromVisualStudio())' == 'true'">$(MSBuildToolsPath32)\..\..\..\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.targets</_NuGetRestoreTargets>
171174
</PropertyGroup>
172175

173176
<!--

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
2-
<Project Sdk="Microsoft.NET.Sdk">
2+
<Project>
33
<Import Project="BuildStep.props" />
44

5+
<!-- Properties requires by NuGet.targets to restore PackageReferences -->
56
<PropertyGroup>
67
<TargetFramework>net472</TargetFramework>
8+
<MSBuildProjectExtensionsPath>$(BaseIntermediateOutputPath)</MSBuildProjectExtensionsPath>
79
</PropertyGroup>
810

911
<!--
@@ -15,6 +17,8 @@
1517
<RestoreConfigFile>$(RepoRoot)NuGet.config</RestoreConfigFile>
1618
</PropertyGroup>
1719

20+
<Import Project="$(_NuGetRestoreTargets)" Condition="'$(DotNetBuildFromSource)' != 'true'"/>
21+
1822
<ItemGroup Condition="'$(DotNetBuildFromSource)' != 'true'">
1923
<!-- Copy of 'sn.exe' in form of NuGet package. -->
2024
<PackageReference Include="sn" Version="$(SNVersion)" IsImplicitlyDefined="true" />
@@ -35,7 +39,7 @@
3539

3640
<Target Name="RestoreRepoTools"
3741
Condition="'$(DotNetBuildFromSource)' != 'true' and Exists('$(_RepoToolManifest)')"
38-
AfterTargets="Restore">
42+
BeforeTargets="Restore">
3943

4044
<Exec Command='"$(DotNetTool)" tool restore' WorkingDirectory="$(RepoRoot)" />
4145
</Target>

0 commit comments

Comments
 (0)