Skip to content

Don't set "platform library" for .NET Core 3.0 and higher #3019

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 12, 2019

Conversation

dsplaisted
Copy link
Member

Don't try to exclude files from the platform library on .NET Core 3.0 and higher, which uses runtime and targeting packs instead

Fixes #3004

To help verify whether this is safe, I looked at the places where MicrosoftNETPlatformLibrary is used:

  • It's used by the GenerateDepsFile, GenerateRuntimeConfigurationFiles, and ResolveCopyLocalAssets tasks. These all simply pass it to LockFileExtensions.CreateProjectContext. In that method, it's used as part of the check to determine if the app is framework dependent:
    bool isFrameworkDependent = (platformLibrary != null || runtimeFrameworks?.Any() == true) &&
        (!isSelfContained || string.IsNullOrEmpty(lockFileTarget.RuntimeIdentifier));
    Note that for .NET Core 3.0 and higher, the ResolveFrameworkReferences should add RuntimeFramework items, so the isFrameworkDependent calculation should still work.
  • In the created ProjectContext, the GetRuntimeLibraries method excludes assets from the platform library for framework dependent apps.
  • The GenerateRuntimeConfigurationFiles task also uses the platform library from the ProjectContext in order to write the runtimeconfig file, but only if there aren't any RuntimeFrameworks.
  • The ResolvePackageAssets task excludes assets from the platform library in GetPlatformPackageExclusions. (It also excludes assets from libraries matching names of RuntimeFrameworks, which I believe we should now remove, as those assets will come from runtime packs and won't be in the assets file anyway now).
  • The _RestoreCrossgen and PrepforRestoreForComposeStore use the platform library name. These are both part of support for dotnet store, which we are considering dropping, and which will need a lot of work in any case if we want it to work when targeting .NET Core 3

… and higher, which uses runtime and targeting packs instead

Fixes dotnet#3004
@dsplaisted dsplaisted requested review from nguerrera and a team March 12, 2019 15:54
@dsplaisted dsplaisted merged commit e5f471e into dotnet:master Mar 12, 2019
dsplaisted pushed a commit to dsplaisted/sdk that referenced this pull request Feb 19, 2020
…build 20191001.1 (dotnet#3019)

- Microsoft.NET.Sdk.Razor - 3.1.0-preview1.19501.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants