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

Commit b0c5fdd

Browse files
author
Nate McMaster
committed
Add a property to disable bundling ASP.NET Core tools, templates, and runtimes
1 parent d17f4ec commit b0c5fdd

File tree

7 files changed

+49
-16
lines changed

7 files changed

+49
-16
lines changed

build/BundledDotnetTools.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2-
<ItemGroup>
2+
<ItemGroup Condition=" '$(IncludeAspNetCoreRuntime)' != 'false' ">
33
<BundledDotnetTools Include="dotnet-dev-certs" Version="$(AspNetCoreVersion)" />
44
<BundledDotnetTools Include="dotnet-ef" Version="$(AspNetCoreVersion)" ObsoletesCliTool="Microsoft.EntityFrameworkCore.Tools.DotNet" />
55
<BundledDotnetTools Include="dotnet-sql-cache" Version="$(AspNetCoreVersion)" ObsoletesCliTool="Microsoft.Extensions.Caching.SqlConfig.Tools" />

build/BundledRuntimes.props

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,6 @@
5555
</PropertyGroup>
5656

5757
<ItemGroup>
58-
<_DownloadAndExtractItem Include="AspNetCoreSharedFxArchiveFile"
59-
Condition="!Exists('$(AspNetCoreSharedFxArchiveFile)') And ( '$(AspNetCoreSharedFxArchiveRid)' == 'linux-arm' OR !$(Architecture.StartsWith('arm')) )">
60-
<Url>$(AspNetCoreSharedFxRootUrl)$(AspNetCoreVersion)/$(AspNetCoreSharedFxArchiveFileName)$(CoreSetupBlobAccessTokenParam)</Url>
61-
<DownloadFileName>$(AspNetCoreSharedFxArchiveFile)</DownloadFileName>
62-
<ExtractDestination>$(AspNetCoreSharedFxPublishDirectory)</ExtractDestination>
63-
</_DownloadAndExtractItem>
64-
6558
<_DownloadAndExtractItem Include="CombinedSharedHostAndFrameworkArchive"
6659
Condition="!Exists('$(CombinedSharedHostAndFrameworkArchive)')">
6760
<Url>$(CoreSetupRootUrl)$(MicrosoftNETCoreAppPackageVersion)/$(CombinedFrameworkHostCompressedFileName)$(CoreSetupBlobAccessTokenParam)</Url>
@@ -96,6 +89,15 @@
9689
<DownloadFileName>$(DownloadedHostFxrInstallerFile)</DownloadFileName>
9790
<ExtractDestination></ExtractDestination>
9891
</_DownloadAndExtractItem>
92+
</ItemGroup>
93+
94+
<ItemGroup Condition=" '$(IncludeAspNetCoreRuntime)' != 'false' ">
95+
<_DownloadAndExtractItem Include="AspNetCoreSharedFxArchiveFile"
96+
Condition="!Exists('$(AspNetCoreSharedFxArchiveFile)') And ( '$(AspNetCoreSharedFxArchiveRid)' == 'linux-arm' OR !$(Architecture.StartsWith('arm')) )">
97+
<Url>$(AspNetCoreSharedFxRootUrl)$(AspNetCoreVersion)/$(AspNetCoreSharedFxArchiveFileName)$(CoreSetupBlobAccessTokenParam)</Url>
98+
<DownloadFileName>$(AspNetCoreSharedFxArchiveFile)</DownloadFileName>
99+
<ExtractDestination>$(AspNetCoreSharedFxPublishDirectory)</ExtractDestination>
100+
</_DownloadAndExtractItem>
99101

100102
<_DownloadAndExtractItem Include="DownloadedAspNetCoreSharedFxInstallerFile"
101103
Condition="'$(SkipBuildingInstallers)' != 'true' AND '$(DownloadedAspNetCoreSharedFxInstallerFile)' != '' AND !Exists($(DownloadedAspNetCoreSharedFxInstallerFile)) And '$(InstallerExtension)' != '' And !$(Architecture.StartsWith('arm'))">

build/BundledTemplates.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
<BundledTemplate Include="Microsoft.DotNet.Common.ItemTemplates" Version="$(MicrosoftDotNetCommonItemTemplatesPackageVersion)" />
44
<BundledTemplate Include="Microsoft.DotNet.Common.ProjectTemplates.2.1" Version="$(MicrosoftDotNetCommonProjectTemplates20PackageVersion)" />
55
<BundledTemplate Include="Microsoft.DotNet.Test.ProjectTemplates.2.1" Version="$(MicrosoftDotNetTestProjectTemplates20PackageVersion)" />
6+
</ItemGroup>
67

8+
<ItemGroup Condition=" '$(IncludeAspNetCoreRuntime)' != 'false' ">
79
<BundledTemplate Include="Microsoft.DotNet.Web.ItemTemplates" Version="$(AspNetCoreVersion)" />
810
<BundledTemplate Include="Microsoft.DotNet.Web.ProjectTemplates.2.1" Version="$(AspNetCoreVersion)" />
911
<BundledTemplate Include="Microsoft.DotNet.Web.Spa.ProjectTemplates" Version="$(AspNetCoreVersion)" />

build/MSBuildExtensions.targets

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,29 @@
123123
<_AspNetCoreAppTargetFrameworkVersion>$(_AspNetCoreAllTargetFrameworkVersion)</_AspNetCoreAppTargetFrameworkVersion>
124124

125125
<_NETCoreSdkIsPreview Condition=" '$(DropSuffix)' == '' ">true</_NETCoreSdkIsPreview>
126+
</PropertyGroup>
127+
128+
<ItemGroup>
129+
<BundledVersionsVariable Include="BundledAspNetCoreAllTargetFrameworkVersion" Value="$(_AspNetCoreAllTargetFrameworkVersion)" />
130+
<BundledVersionsVariable Include="BundledAspNetCoreAllPackageVersion" Value="$(_AspNetCoreAllPackageVersion)" />
131+
<BundledVersionsVariable Include="BundledAspNetCoreAppTargetFrameworkVersion" Value="$(_AspNetCoreAppTargetFrameworkVersion)" />
132+
<BundledVersionsVariable Include="BundledAspNetCoreAppPackageVersion" Value="$(_AspNetCoreAppPackageVersion)" />
133+
</ItemGroup>
126134

135+
<ItemGroup Condition=" '$(IncludeAspNetCoreRuntime)' == 'false' ">
136+
<!--
137+
These properties indicate that the ASP.NET Core shared runtime is not bundled on this platform, so the SDK should not
138+
treat these packages as the 'platform' base.
139+
140+
The bundled aspnet packages versions should still be set, however, so the default, version-less PackageReference
141+
still works.
142+
See also https://github.com/aspnet/Universe/pull/1130.
143+
-->
144+
<BundledVersionsVariable Include="_AspNetCoreAppSharedFxIsEnabled" Value="false" />
145+
<BundledVersionsVariable Include="_AspNetCoreAllSharedFxIsEnabled" Value="false" />
146+
</ItemGroup>
147+
148+
<PropertyGroup>
127149
<BundledVersionsPropsContent>
128150
<![CDATA[
129151
<!--
@@ -144,10 +166,7 @@ Copyright (c) .NET Foundation. All rights reserved.
144166
<BundledNETStandardTargetFrameworkVersion>$(_NETStandardTargetFrameworkVersion)</BundledNETStandardTargetFrameworkVersion>
145167
<BundledNETStandardPackageVersion>$(_NETStandardLibraryPackageVersion)</BundledNETStandardPackageVersion>
146168
<BundledNETCorePlatformsPackageVersion>$(_NETCorePlatformsPackageVersion)</BundledNETCorePlatformsPackageVersion>
147-
<BundledAspNetCoreAllTargetFrameworkVersion>$(_AspNetCoreAllTargetFrameworkVersion)</BundledAspNetCoreAllTargetFrameworkVersion>
148-
<BundledAspNetCoreAllPackageVersion>$(_AspNetCoreAllPackageVersion)</BundledAspNetCoreAllPackageVersion>
149-
<BundledAspNetCoreAppTargetFrameworkVersion>$(_AspNetCoreAppTargetFrameworkVersion)</BundledAspNetCoreAppTargetFrameworkVersion>
150-
<BundledAspNetCoreAppPackageVersion>$(_AspNetCoreAppPackageVersion)</BundledAspNetCoreAppPackageVersion>
169+
@(BundledVersionsVariable->'<%(Identity)>%(Value)</%(Identity)>', '%0A ')
151170
<NETCoreSdkVersion>$(SdkVersion)</NETCoreSdkVersion>
152171
<_NETCoreSdkIsPreview>$(_NETCoreSdkIsPreview)</_NETCoreSdkIsPreview>
153172

src/Microsoft.DotNet.Configurer/DotnetFirstTimeUseConfigurer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,16 @@ private void GenerateAspNetCertificate()
9090

9191
private bool ShouldGenerateAspNetCertificate()
9292
{
93+
#if EXCLUDE_ASPNETCORE
94+
return false;
95+
#else
9396
var generateAspNetCertificate =
9497
_environmentProvider.GetEnvironmentVariableAsBool("DOTNET_GENERATE_ASPNET_CERTIFICATE", true);
9598

9699
return ShouldRunFirstRunExperience() &&
97100
generateAspNetCertificate &&
98101
!_aspNetCertificateSentinel.Exists();
102+
#endif
99103
}
100104

101105
private bool ShouldAddPackageExecutablePath()
@@ -153,7 +157,7 @@ private void PrintNugetCachePrimeMessage()
153157

154158
private bool ShouldRunFirstRunExperience()
155159
{
156-
var skipFirstTimeExperience =
160+
var skipFirstTimeExperience =
157161
_environmentProvider.GetEnvironmentVariableAsBool("DOTNET_SKIP_FIRST_TIME_EXPERIENCE", false);
158162

159163
return !skipFirstTimeExperience;
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) .NET Foundation and contributors. All rights reserved.
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4-
using Microsoft.AspNetCore.DeveloperCertificates.XPlat;
54
using Microsoft.DotNet.Configurer;
65

76
namespace Microsoft.DotNet.Cli
@@ -10,7 +9,9 @@ public class AspNetCoreCertificateGenerator : IAspNetCoreCertificateGenerator
109
{
1110
public void GenerateAspNetCoreDevelopmentCertificate()
1211
{
13-
CertificateGenerator.GenerateAspNetHttpsCertificate();
12+
#if !EXCLUDE_ASPNET
13+
Microsoft.AspNetCore.DeveloperCertificates.XPlat.CertificateGenerator.GenerateAspNetHttpsCertificate();
14+
#endif
1415
}
1516
}
1617
}

src/dotnet/dotnet.csproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
1010
<AssetTargetFallback>dotnet5.4</AssetTargetFallback>
1111
<RootNamespace>Microsoft.DotNet.Cli</RootNamespace>
12+
<DefineConstants Condition="'$(IncludeAspNetCoreRuntime)' == 'false'">$(DefineConstants);EXCLUDE_ASPNETCORE</DefineConstants>
1213
</PropertyGroup>
1314
<ItemGroup>
1415
<Compile Remove="commands\dotnet-new\**" />
@@ -60,7 +61,6 @@
6061
<PackageReference Include="System.Diagnostics.TextWriterTraceListener" Version="4.3.0" />
6162
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
6263
<PackageReference Include="System.Private.DataContractSerialization" Version="4.3.0" />
63-
<PackageReference Include="Microsoft.AspNetCore.DeveloperCertificates.XPlat" Version="$(AspNetCoreVersion)" />
6464
<PackageReference Include="Microsoft.Win32.Registry" Version="4.3.0" />
6565
<PackageReference Include="Microsoft.Build" Version="$(MicrosoftBuildPackageVersion)" />
6666
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="$(MicrosoftDotNetPlatformAbstractionsPackageVersion)" />
@@ -75,6 +75,11 @@
7575
<PackageReference Include="Microsoft.DotNet.Archive" Version="$(MicrosoftDotNetArchivePackageVersion)" />
7676
<PackageReference Include="XliffTasks" Version="$(XliffTasksPackageVersion)" PrivateAssets="All" />
7777
</ItemGroup>
78+
79+
<ItemGroup Condition=" '$(IncludeAspNetCoreRuntime)' != 'false' ">
80+
<PackageReference Include="Microsoft.AspNetCore.DeveloperCertificates.XPlat" Version="$(AspNetCoreVersion)" />
81+
</ItemGroup>
82+
7883
<ItemGroup>
7984
<Folder Include="commands\dotnet-migrate\xlf" />
8085
<Folder Include="dotnet-complete\commands\" />

0 commit comments

Comments
 (0)