Open jewinkle opened 5 years ago
@dsplaisted can you take a look?
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
Is there something that can be used in 3.0 so that we can trim down the packages generated by the runtime store?
Can you supply the full repro steps of what you are trying to store?
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:
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="PackageToStore" Version="42.42.42" />
</ItemGroup>
</Project>
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:
<Target Name="_ResolveTargetingPackAssetsForStore"
AfterTargets="ResolvePackageAssets"
DependsOnTargets="ResolveTargetingPackAssets" />
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:
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="PackageToStore" Version="42.42.42" />
</ItemGroup>
<Target Name="_ResolveTargetingPackAssetsForStore"
AfterTargets="ResolvePackageAssets"
DependsOnTargets="ResolveTargetingPackAssets" />
</Project>
Steps to reproduce
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]
.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]