Add property to allow the SDK to disable shared framework trimming (#1130)

The MicrosoftNETPlatformLibrary property instructs the .NET Core SDK to treat a particular package as the shared framework platform. This affects how the SDK will trim references and publish output, determines how the runtimeconfig files are generated, and may affect how optimizations are preformed by other tools. In some installations of .NET Core, the ASP.NET Core shared framework is not available. This change adds properties to let the SDK determine on which platforms ASP.NET Core is enabled.
This commit is contained in:
Nate McMaster 2018-05-02 08:49:03 -07:00 committed by GitHub
parent 678f4f5993
commit d6f15759fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 6 deletions

View File

@ -1,5 +1,19 @@
<Project>
<PropertyGroup>
<MicrosoftNETPlatformLibrary>Microsoft.AspNetCore.All</MicrosoftNETPlatformLibrary>
<!--
The _AspNetCoreAllSharedFxIsEnabled property is meant for internal use only. When set to 'false',
the default value of MicrosoftNETPlatformLibrary will be Microsoft.NETCore.App. It was added to support
a better SDK exprience on platforms where the ASP.NET Core shared framework is not avaiable.
In these cases, ASP.NET Core can still be as if it were just a set of NuGet packages.
-->
<PropertyGroup Condition=" '$(_AspNetCoreAllSharedFxIsEnabled)' == '' ">
<!--
Disable the base runtime, Microsoft.AspNetCore.App, when this package is imported
-->
<_AspNetCoreAppSharedFxIsEnabled>false</_AspNetCoreAppSharedFxIsEnabled>
<!--
NB: this is _AspNetCore*All*SharedFxIsEnabled, not _AspNetCore*App*SharedFxIsEnabled
-->
<_AspNetCoreAllSharedFxIsEnabled>true</_AspNetCoreAllSharedFxIsEnabled>
</PropertyGroup>
</Project>
</Project>

View File

@ -1,4 +1,15 @@
<Project>
<!--
This property instructs the .NET Core SDK to treat this package as the shared framework platform.
This affects how the SDK will trim references and publish output, determines how the runtimeconfig
files are generated, and may affect how optimizations are preformed by other tools.
NB: this is _AspNetCore*All*SharedFxIsEnabled, not _AspNetCore*App*SharedFxIsEnabled
-->
<PropertyGroup Condition=" '$(_AspNetCoreAllSharedFxIsEnabled)' == 'true' ">
<MicrosoftNETPlatformLibrary>Microsoft.AspNetCore.All</MicrosoftNETPlatformLibrary>
</PropertyGroup>
<Target Name="EnsureTFMCompatibility" BeforeTargets="_CheckForInvalidConfigurationAndPlatform">
<Error
Text="This version of Microsoft.AspNetCore.All is only compatible with the netcoreapp2.1 target framework. Please target netcoreapp2.1 or choose a version of Microsoft.AspNetCore.All compatible with $(TargetFramework)."

View File

@ -1,6 +1,14 @@
<Project>
<!--
The _AspNetCoreAppSharedFxIsEnabled property is meant for internal use only. When set to 'false',
the default value of MicrosoftNETPlatformLibrary will be used. It was added to support
a better SDK exprience on platforms where the ASP.NET Core shared framework is not avaiable.
In these cases, ASP.NET Core can still be as if it were just a set of NuGet packages.
NB: this is _AspNetCore*App*SharedFxIsEnabled, not _AspNetCore*All*SharedFxIsEnabled
-->
<PropertyGroup>
<MicrosoftNETPlatformLibrary>Microsoft.AspNetCore.App</MicrosoftNETPlatformLibrary>
<_AspNetCoreAppSharedFxIsEnabled Condition=" '$(_AspNetCoreAppSharedFxIsEnabled)' == '' ">true</_AspNetCoreAppSharedFxIsEnabled>
</PropertyGroup>
<!--
@ -9,5 +17,5 @@
<ItemGroup>
<ProjectCapability Include="AspNetInProcessHosting" />
</ItemGroup>
</Project>
</Project>

View File

@ -1,4 +1,15 @@
<Project>
<!--
This property instructs the .NET Core SDK to treat this package as the shared framework platform.
This affects how the SDK will trim references and publish output, determines how the runtimeconfig
files are generated, and may affect how optimizations are preformed by other tools.
NB: this is _AspNetCore*App*SharedFxIsEnabled, not _AspNetCore*All*SharedFxIsEnabled
-->
<PropertyGroup Condition=" '$(_AspNetCoreAppSharedFxIsEnabled)' == 'true' ">
<MicrosoftNETPlatformLibrary>Microsoft.AspNetCore.App</MicrosoftNETPlatformLibrary>
</PropertyGroup>
<Target Name="EnsureTFMCompatibility" BeforeTargets="_CheckForInvalidConfigurationAndPlatform">
<Error
Text="This version of Microsoft.AspNetCore.App is only compatible with the netcoreapp2.1 target framework. Please target netcoreapp2.1 or choose a version of Microsoft.AspNetCore.App compatible with $(TargetFramework)."