Skip to content

Preview3 - Razor Component project fails to build with a 'ResolvePackageAssets' task failure #8276

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

Closed
MarkStega opened this issue Mar 7, 2019 · 10 comments
Assignees
Labels
area-blazor Includes: Blazor, Razor Components question

Comments

@MarkStega
Copy link

MarkStega commented Mar 7, 2019

Describe the bug

I am trying to port a server side 0.8.0 Blazor application to be a Razor component of my web server using Asp.Net Core preview 3.

To Reproduce

I have moved all of my assets from a Blazor app to be server side following the pattern of the new RazorComponent single project solution. The project that is the server with the RCs fails to build with:

9 ------ Build started: Project: Optimiser.Web, Configuration: Debug Any CPU ------ 9 C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(228,5): error MSB4018: The "ResolvePackageAssets" task failed unexpectedly. 9 C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(228,5): error MSB4018: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. 9 C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(228,5): error MSB4018: at System.Collections.Generic.Dictionary2.get_Item(TKey key)
9 C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(228,5): error MSB4018: at Microsoft.NET.Build.Tasks.LockFileExtensions.CollectDependencies(IDictionary2 libraryLookup, IEnumerable1 dependencies, HashSet1 exclusionList) in /_/src/Tasks/Microsoft.NET.Build.Tasks/LockFileExtensions.cs:line 193 9 C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(228,5): error MSB4018: at Microsoft.NET.Build.Tasks.LockFileExtensions.CollectDependencies(IDictionary2 libraryLookup, IEnumerable1 dependencies, HashSet1 exclusionList) in /_/src/Tasks/Microsoft.NET.Build.Tasks/LockFileExtensions.cs:line 180
9 C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(228,5): error MSB4018: at Microsoft.NET.Build.Tasks.LockFileExtensions.GetPlatformExclusionList(LockFileTarget lockFileTarget, LockFileTargetLibrary platformLibrary, IDictionary2 libraryLookup) in /_/src/Tasks/Microsoft.NET.Build.Tasks/LockFileExtensions.cs:line 153 9 C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(228,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheWriter.GetPlatformPackageExclusions() in /_/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs:line 1191 9 C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(228,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheWriter..ctor(ResolvePackageAssets task, Stream stream) in /_/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs:line 610 9 C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(228,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader.CreateReaderFromDisk(ResolvePackageAssets task, Byte[] settingsHash) in /_/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs:line 483 9 C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(228,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader..ctor(ResolvePackageAssets task) in /_/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs:line 434 9 C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(228,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ReadItemGroups() in /_/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs:line 279 9 C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(228,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ExecuteCore() in /_/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs:line 271 9 C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(228,5): error MSB4018: at Microsoft.NET.Build.Tasks.TaskBase.Execute() in /_/src/Tasks/Common/TaskBase.cs:line 35 9 C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(228,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() 9 C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(228,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() 9 Done building project "Optimiser.Web.csproj" -- FAILED.

Expected behavior

I expect to be able to build the project

I would like to know how to track down this issue if the suspicion is that it in my code base.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

VS2019P4
C:\Solutions\OHI\Optimiser>dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.0.100-preview3-010431
Commit: d72abce213

Runtime Environment:
OS Name: Windows
OS Version: 10.0.17763
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\

Host (useful for support):
Version: 3.0.0-preview3-27503-5
Commit: 3844df9537

.NET Core SDKs installed:
2.1.600 [C:\Program Files\dotnet\sdk]
2.2.200 [C:\Program Files\dotnet\sdk]
3.0.100-preview3-010431 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0-preview3-19153-02 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-preview3-27503-5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0-preview3-27504-2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

C:\Solutions\OHI\Optimiser>

@muratg muratg added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Mar 7, 2019
@mkArtakMSFT mkArtakMSFT added the area-blazor Includes: Blazor, Razor Components label Mar 7, 2019
@netclectic
Copy link

I see the same issue when updating an existing 0.8.0 Blazor (Asp.Net Core Hosted) application and also when creating a new 0.9.0 Blazor (Asp.Net Core Hosted) application.

@MarkStega
Copy link
Author

MarkStega commented Mar 11, 2019

I have two PoC apps that exhibited this error. I managed to get one of them to build. The other I still haven't succeeded. The error is slightly different when the build it done from the command line:

C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(228,5): error MSB4018: The "ResolvePackageAssets" task failed unexpectedly. [C:\Solutions\OHI\Busy-Beacons\BusyBeaconsAdmin.Server\BusyBeaconsAdmin.Server.csproj]
C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(228,5): error MSB4018: System.Collections.Generic.KeyNotFoundException: The given key 'NETStandard.Library' was not present in the dictionary. [C:\Solutions\OHI\Busy-Beacons\BusyBeaconsAdmin.Server\BusyBeaconsAdmin.Server.csproj]
C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(228,5): error MSB4018: at System.Collections.Generic.Dictionary`2.get_Item(TKey key) [C:\Solutions\OHI\Busy-Beacons\BusyBeaconsAdmin.Server\BusyBeaconsAdmin.Server.csproj]

@MarkStega
Copy link
Author

MarkStega commented Mar 18, 2019

I have a reproducible (albeit large) solution in which I can change one nuget package reference and the error appears/disappears.

The project layout is

App.Client - An RC library that was converted from a Blazor 0.8.0 library; It contains the app.cshtml that is the entry point for the RC components. It ran as server side execution Blazor in 0.8.0

App.Server - A 3.0.0.P2 web server that hosts the RC

App.Server has a package reference that is
< < PackageReference Include="BuildWebCompiler" Version="1.12.394" /> >

If I remove this package reference either via nuget or directly removing it from the project file I get the error documented above, if I add it back the error disappears. There is no need for the package as I have my wwwroot folder and all of the scss files that need to be built in the App.Client project.

[Edit] When the error appears the nuget package references all show a yellow triangle and the SDK reference disappears. I didn't speciofy above but this is VS 16.0.0 P4.2

@SteveSandersonMS
Copy link
Member

Can you post repro steps, starting from creating a new project and not using third-party dependencies?

I know that's nontrivial to do, but it's the only way I'll be able to identify whether there's a bug or whether there was a mistake in your upgrade process. Thanks.

@davidfowl
Copy link
Member

cc @nguerrera

@MarkStega
Copy link
Author

Can you post repro steps, starting from creating a new project and not using third-party dependencies?

I know that's nontrivial to do, but it's the only way I'll be able to identify whether there's a bug or whether there was a mistake in your upgrade process. Thanks.

Steve,

Since I have no idea what causes the problem I don't think that I can create a repro case. I tried a very simple new project and added/removed the dependency with no issue. I would be willing to allow you or a team member access to my project repository. It should be a simple matter to clone the repository and then demonstrate the problem. Since this is a build issue you would not need any of the surrounding infrastructure needed to run the project.

@mkArtakMSFT
Copy link
Contributor

Thanks @MarkStega.
This is not something we've heard many complaints about and given no repro and the fact that you're now unblocked we're closing this.

@MarkStega
Copy link
Author

I don't think this should be closed. I can't remove an unneeded nuget package from my project without getting the error and I offered access to my project repository that has an easy repro.

@netclectic
Copy link

BuildWebCompiler

App.Server has a package reference that is
< < PackageReference Include="BuildWebCompiler" Version="1.12.394" /> >

That's interesting, I found that my client project has a reference to BuildWebCompiler (also 1.12.394) but my server project does not. As soon as I remove the reference from the client then the everything builds ok and we're off to the races.

@MarkStega
Copy link
Author

My App.Client still has the wwwroot directory which I map on the server. So my client needs (and has the reference). My server does not have resources that need to be built, hence my desire to remove the BuildWebCompiler reference from Server.csproj

@mkArtakMSFT mkArtakMSFT removed area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates labels May 9, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components question
Projects
None yet
Development

No branches or pull requests

6 participants