Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Commit fe6d6fa

Browse files
author
Nate McMaster
committed
Generate Microsoft.NETCoreSdk.BundledCliTools.props
1 parent 67c4562 commit fe6d6fa

File tree

2 files changed

+46
-10
lines changed

2 files changed

+46
-10
lines changed

build/BundledDotnetTools.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22
<ItemGroup>
33
<BundledDotnetTools Include="dotnet-dev-certs" Version="$(AspNetCoreVersion)" />
4-
<BundledDotnetTools Include="dotnet-sql-cache" Version="$(AspNetCoreVersion)" />
5-
<BundledDotnetTools Include="dotnet-user-secrets" Version="$(AspNetCoreVersion)" />
6-
<BundledDotnetTools Include="dotnet-watch" Version="$(AspNetCoreVersion)" />
4+
<BundledDotnetTools Include="dotnet-sql-cache" Version="$(AspNetCoreVersion)" ObsoletesCliTool="Microsoft.Extensions.Caching.SqlConfig.Tools" />
5+
<BundledDotnetTools Include="dotnet-user-secrets" Version="$(AspNetCoreVersion)" ObsoletesCliTool="Microsoft.Extensions.SecretManager.Tools" />
6+
<BundledDotnetTools Include="dotnet-watch" Version="$(AspNetCoreVersion)" ObsoletesCliTool="Microsoft.DotNet.Watcher.Tools" />
77
</ItemGroup>
88
</Project>

build/MSBuildExtensions.targets

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
11
<Project>
2+
<Import Project="BundledDotnetTools.props" />
3+
24
<Target Name="GenerateMSBuildExtensions"
3-
DependsOnTargets="GenerateBundledVersionsProps;RestoreMSBuildExtensionsPackages">
5+
DependsOnTargets="GenerateBundledVersionsProps;GenerateBundledCliToolsProps;RestoreMSBuildExtensionsPackages">
46

57
<ItemGroup>
6-
8+
79
<!-- The MSBuildExtensionsContent item is for the files that will be laid out in the CLI install -->
810
<MSBuildExtensionsContent Include="$(GeneratedMSBuildExtensionsDirectory)/**/*" />
911

1012
<!-- We want to include the tasks and targets from the Microsoft.NET.Build.Extensions package, but we don't want to include the DLLs
1113
from that package under the net461, net462, etc folders. That is because they come from the NETStandard.Library.NETFramework
1214
package, and we want to insert them directly into the CLI from CoreFx instead of having to do a two-hop insertion (CoreFX -> SDK -> CLI)
1315
if we need to update them.
14-
16+
1517
https://github.com/dotnet/sdk/issues/1324 has been filed to exclude these from the Microsoft.NET.Build.Extensions package when
1618
we generate it.
1719
-->
1820
<MSBuildExtensionsContent Include="$(MSBuildExtensionsNuPkgPath)\msbuildExtensions\**\*.*"
1921
Exclude="$(MSBuildExtensionsNuPkgPath)\msbuildExtensions\Microsoft\Microsoft.NET.Build.Extensions\net*\**" />
20-
22+
2123
<!-- Don't include .NET Framework MS.NET.Build.Extensions tasks in CLI layout -->
2224
<MSBuildExtensionsContent Remove="$(MSBuildExtensionsNuPkgPath)\msbuildExtensions\Microsoft\Microsoft.NET.Build.Extensions\tools\net46\**" />
2325

2426
<MSBuildExtensionsContent Include="$(MSBuildExtensionsNuPkgPath)\msbuildExtensions-ver\**\*.*"
2527
DeploymentSubpath="$(MSBuildExtensionsVersionSubfolder)/" />
26-
28+
2729
<MSBuildExtensionsContent Include="$(NETStandardLibraryNETFrameworkNuPkgPath)\build\**\*.*"
2830
Exclude="$(NETStandardLibraryNETFrameworkNuPkgPath)\build\**\*.props;$(NETStandardLibraryNETFrameworkNuPkgPath)\build\**\*.targets"
2931
DeploymentSubpath="Microsoft/Microsoft.NET.Build.Extensions/" />
@@ -68,7 +70,7 @@
6870
<ItemGroup>
6971
<ExtensionPackageToRestore Include="$(MSBuildExtensionsPackageName)" Version="$(MicrosoftNETBuildExtensionsPackageVersion)"/>
7072
<ExtensionPackageToRestore Include="$(NETStandardLibraryNETFrameworkPackageName)" Version="$(CLI_NETStandardLibraryNETFrameworkVersion)"/>
71-
73+
7274
<ExtensionRestore Include="$(RepoRoot)/build/RestoreDependency.proj">
7375
<Properties>
7476
CLIBuildDll=$(CLIBuildDll);
@@ -91,7 +93,7 @@
9193
<BundledVersionsPropsFileName>Microsoft.NETCoreSdk.BundledVersions.props</BundledVersionsPropsFileName>
9294
</PropertyGroup>
9395

94-
<!--
96+
<!--
9597
The bundled version of Microsoft.NETCore.App is determined statically from DependencyVersions.props whereas the bundled version
9698
of NETStandard.Library is defined by what Microsoft.NETCore.App pulls in. This digs in to the package resolution items of
9799
of our build against Microsoft.NETCore.App to find the correct NETStandard.Library version
@@ -152,4 +154,38 @@ Copyright (c) .NET Foundation. All rights reserved.
152154
Lines="$(BundledVersionsPropsContent)"
153155
Overwrite="true" />
154156
</Target>
157+
158+
<Target Name="GenerateBundledCliToolsProps">
159+
<PropertyGroup>
160+
<BundledBundledCliToolsPropsFileName>Microsoft.NETCoreSdk.BundledCliTools.props</BundledBundledCliToolsPropsFileName>
161+
</PropertyGroup>
162+
163+
<PropertyGroup>
164+
<BundledBundledCliToolsPropsContent>
165+
<![CDATA[
166+
<!--
167+
***********************************************************************************************
168+
$(BundledBundledCliToolsPropsFileName)
169+
170+
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
171+
created a backup copy. Incorrect changes to this file will make it
172+
impossible to load or build your projects from the command-line or the IDE.
173+
174+
Copyright (c) .NET Foundation. All rights reserved.
175+
***********************************************************************************************
176+
-->
177+
<Project>
178+
<ItemGroup>
179+
@(BundledDotnetTools->HasMetadata('ObsoletesCliTool')->' %3CBundledDotNetCliToolReference Include="%(ObsoletesCliTool)" /%3E','%0A')
180+
</ItemGroup>
181+
</Project>
182+
]]>
183+
</BundledBundledCliToolsPropsContent>
184+
</PropertyGroup>
185+
186+
<MakeDir Directories="$(GeneratedMSBuildExtensionsDirectory)" />
187+
<WriteLinesToFile File="$(GeneratedMSBuildExtensionsDirectory)/$(BundledBundledCliToolsPropsFileName)"
188+
Lines="$(BundledBundledCliToolsPropsContent)"
189+
Overwrite="true" />
190+
</Target>
155191
</Project>

0 commit comments

Comments
 (0)