MicrosoftNETPlatformLibrary property for Microsoft.AspNetCore.App fails with NRE for .NET Core 3.0
See original GitHub issueSteps to reproduce
cat .\error.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<MicrosoftNETPlatformLibrary>Microsoft.AspNetCore.App</MicrosoftNETPlatformLibrary>
</PropertyGroup>
</Project>
dotnet store -f netcoreapp3.0 --manifest .\error.csproj -r win7-x64 --skip-optimization --output .\output --skip-symbols
Microsoft (R) Build Engine version 16.3.0-preview-19426-01+faf5e5d75 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 121.52 ms for C:\Users\jewinkle\3.0error\error.csproj.
C:\Program Files\dotnet\sdk\3.0.100-preview9-014004\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ComposeStore.targets(420,5): error MSB4018: The "FilterResolvedFiles" task failed unexpectedly. [C:\Users\jewinkle\3.0error\error.csproj]
C:\Program Files\dotnet\sdk\3.0.100-preview9-014004\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ComposeStore.targets(420,5): error MSB4018: System.NullReferenceException: Object reference not set to an instance of an object. [C:\Users\jewinkle\3.0error\error.csproj]
C:\Program Files\dotnet\sdk\3.0.100-preview9-014004\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ComposeStore.targets(420,5): error MSB4018: at Microsoft.NET.Build.Tasks.LockFileExtensions.GetTransitivePackagesList(LockFileTarget lockFileTarget, LockFileTargetLibrary package, IDictionary`2 libraryLookup) in /_/src/Tasks/Microsoft.NET.Build.Tasks/LockFileExtensions.cs:line 168 [C:\Users\jewinkle\3.0error\error.csproj]
C:\Program Files\dotnet\sdk\3.0.100-preview9-014004\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ComposeStore.targets(420,5): error MSB4018: at Microsoft.NET.Build.Tasks.ProjectContext.GetTransitiveList(String package) in /_/src/Tasks/Microsoft.NET.Build.Tasks/ProjectContext.cs:line 155 [C:\Users\jewinkle\3.0error\error.csproj]
C:\Program Files\dotnet\sdk\3.0.100-preview9-014004\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ComposeStore.targets(420,5): error MSB4018: at Microsoft.NET.Build.Tasks.FilterResolvedFiles.ExecuteCore() in /_/src/Tasks/Microsoft.NET.Build.Tasks/FilterResolvedFiles.cs:line 69 [C:\Users\jewinkle\3.0error\error.csproj]
C:\Program Files\dotnet\sdk\3.0.100-preview9-014004\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ComposeStore.targets(420,5): error MSB4018: at Microsoft.NET.Build.Tasks.TaskBase.Execute() in /_/src/Tasks/Common/TaskBase.cs:line 38 [C:\Users\jewinkle\3.0error\error.csproj]
C:\Program Files\dotnet\sdk\3.0.100-preview9-014004\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ComposeStore.targets(420,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\Users\jewinkle\3.0error\error.csproj]
C:\Program Files\dotnet\sdk\3.0.100-preview9-014004\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ComposeStore.targets(420,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [C:\Users\jewinkle\3.0error\error.csproj]
Expected behavior
Store is generated that excludes assets that exist in Microsoft.AspNetCore.App
Actual behavior
Crashes with NRE
Environment data
dotnet --info
output:
.NET Core SDK (reflecting any global.json):
Version: 3.0.100-preview9-014004
Commit: 8e7ef240a5
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.0.100-preview9-014004\
Host (useful for support):
Version: 3.0.0-preview9-19423-09
Commit: 2be172345a
.NET Core SDKs installed:
2.1.801 [C:\Program Files\dotnet\sdk]
2.2.401 [C:\Program Files\dotnet\sdk]
3.0.100-preview7-012802 [C:\Program Files\dotnet\sdk]
3.0.100-preview8-013656 [C:\Program Files\dotnet\sdk]
3.0.100-preview9-014004 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0-preview8.19405.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0-preview9.19424.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-preview8-28405-07 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-preview9-19423-09 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0-preview8-28405-07 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.0.0-preview9-19423-09 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
NETSDK1079: The Microsoft.AspNetCore.All package is ...
You may receive this error message when: You retarget an ASP.NET Core project from .NET Core 2.2 or earlier to .NET Core 3.0...
Read more >Migrate from ASP.NET Core 2.2 to 3.0
This article explains how to update an existing ASP.NET Core 2.2 project to ASP.NET Core 3.0. It might be helpful to create a...
Read more >PackageReference to Microsoft.AspNetCore.App is not ...
This error typically occurs after you've upgraded a project to .NET Core 3.0 or later, from an earlier version that required PackageReference ...
Read more >Breaking changes in .NET Core 3.0
If you're migrating to version 3.0 of .NET Core, ASP.NET Core, or EF Core, the breaking changes listed in this article may affect...
Read more >Breaking changes in .NET Core 3.1
If you're migrating to version 3.1 of .NET Core or ASP.NET Core, the breaking changes listed in this article may affect your app....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We should fix the error message. However, if you are targeting 3.0, then I think you should not set MicrosoftNETPlatformLibrary in this scenario. The shared framework is no longer represented as NuGet packages, so it shouldn’t be part of the store by default.
FYI @nguerrera
The way this should work is that you would add a FrameworkReference to Microsoft.AspNetCore.App. However, there is a bug here that the target that loads the “platform manifests” that say which packages are subsumed by the shared framework is not running in .NET Store.
So instead of setting MicrosoftNETPlatformLibrary, you would have the following:
However, due to the bug, this still doesn’t have the desired effect. The bug can be worked around by forcing ResolveTargetingPackAssets to run at the appropriate time, and load the platform manifests:
Putting these together, the following will cause PackageToStore version 42.42.42 + all of its dependencies that are not in the ASP.NET 3.0 shared framework or base .NET Core shared framework in the store: