Skip to content
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

Error NETSDK1047: Assets file 'project.assets.json' doesn't have a target for '.NETCoreApp,Version=v5.0/linux-x64'. #24521

Closed
BrunoBlanes opened this issue Jul 29, 2020 · 22 comments
Assignees
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. Status: Resolved
Milestone

Comments

@BrunoBlanes
Copy link

I have an automated build pipeline in Azure DevOps and since I updated my project to .NET Preview 7 it throws this error during the build phase. Before this step a restore is successfully completed.
My project file already has framwork and runtime identifiers defined as shown:

<TargetFramework>net5.0</TargetFramework>
<RuntimeIdentifiers>win-x86;win-x64;win-arm;linux-x64;linux-arm</RuntimeIdentifiers>

The pipeline passed during Preview 6 with no other changes made to the project.

@BrunoBlanes
Copy link
Author

It appears to have something to do with the following addition to .NET 5 Preview 7:

<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>

This is a Blazor WebAssembly application that I am trying to build, though that tag is on the client, not the server project.

@wli3 wli3 transferred this issue from dotnet/sdk Aug 3, 2020
@wli3
Copy link

wli3 commented Aug 3, 2020

This looks like the RuntimeIdentifier being global property issue.

@BrunoBlanes
Copy link
Author

Do you mean this is on my end?

@wli3
Copy link

wli3 commented Aug 3, 2020

@BrunoBlanes this might be a bug in the product. The above comment is to help us to investigate

@BrunoBlanes
Copy link
Author

Ok cool, thanks for clarifying!

@javiercn javiercn added area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly labels Aug 3, 2020
@mkArtakMSFT mkArtakMSFT added the enhancement This issue represents an ask for new feature or an enhancement to an existing one label Aug 3, 2020
@mkArtakMSFT mkArtakMSFT added this to the Next sprint planning milestone Aug 3, 2020
@ghost
Copy link

ghost commented Aug 3, 2020

Thanks for contacting us.
We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We will evaluate the request when we are planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@mkArtakMSFT
Copy link
Member

What we plan to do here

We will consider thrown an error when a Blazor WebAssembly project is being build with a RID which is not browser-wasm.

@BrunoBlanes
Copy link
Author

What should I do to get Azure DevOps to build the project?

@mehalick
Copy link

mehalick commented Aug 4, 2020

I receive the same error when publishing my server project that references a Blazor wasm client project.

- task: DotNetCoreCLI@2
  displayName: 'Publish App'
  inputs:
    command: 'publish'
    publishWebProjects: false
    projects: '**/Maki.Server.csproj'
    arguments: '--configuration $(BuildConfiguration) --runtime win-x64 --self-contained true --output $(Build.ArtifactStagingDirectory)'
    zipAfterPublish: true

In DevOps:

C:\hostedtoolcache\windows\dotnet\sdk\5.0.100-preview.7.20366.6\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(241,5): error NETSDK1047: Assets file 'd:\a\1\s\src\Maki.Client\obj\project.assets.json' doesn't have a target for '.NETCoreApp,Version=v5.0/browser-wasm'. Ensure that restore has run and that you have included 'net5.0' in the TargetFrameworks for your project. You may also need to include 'browser-wasm' in your project's RuntimeIdentifiers. [d:\a\1\s\src\Maki.Client\Maki.Client.csproj]

@svetovid
Copy link

I encountered the same problem (.NET5 preview 7):

  1. Create Blazor WebAssembly App hosted in ASP.NET Core
    <TargetFramework>net5.0</TargetFramework>
    <RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
    <UseBlazorWebAssembly>true</UseBlazorWebAssembly>
  1. Publish BlazorApp.Server
    dotnet publish -c Release -r win-x64

Result:
... project.assets.json doesn't have a target for '.NETCoreApp,Version=v5.0/browser-wasm'. Ensure that restore has run and that you have included 'net5.0' in the TargetFrameworks for your project. You may also need to include 'browser-wasm' in your project's RuntimeIdentifiers.

It works however in this case:
dotnet publish -c Release

@bmoteria
Copy link

@wli3 Any update on this one? The issue seems to persist with .NET 5 RC1. Azure DevOps Server is unable to build successfully.

@BrunoBlanes
Copy link
Author

@wli3 I haven't tested it yet on RC1, however, the docs for the new version did mention that both lines below should be removed:

<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
<UseBlazorWebAssembly>true</UseBlazorWebAssembly>

So I don't think the error message should still be present.

@RugerSR9
Copy link

RugerSR9 commented Oct 5, 2020

Bump. Am also having this issue even with non-Blazor projects.

@SteveSandersonMS SteveSandersonMS added affected-most This issue impacts most of the customers bug This issue describes a behavior which is not expected - a bug. severity-blocking This label is used by an internal tool labels Oct 7, 2020 — with ASP.NET Core Issue Ranking
@SteveSandersonMS SteveSandersonMS removed the enhancement This issue represents an ask for new feature or an enhancement to an existing one label Oct 7, 2020
@dotnet dotnet deleted a comment Oct 9, 2020
@mkArtakMSFT mkArtakMSFT modified the milestones: Backlog, 5.0.0 Oct 9, 2020
@mkArtakMSFT
Copy link
Member

@pranavkm can you please make sure this is addressed in 5.0, if not already? Thanks!

@pranavkm
Copy link
Contributor

This has been addressed in 5.0-rc1. If you're still having trouble with Blazor WebAssembly projects, please share a minimal app that reproduces the issue.

@RugerSR9 your problem appears to be different from the one being discussed here (since it's not specific to Blazor Wasm). Could you file a separate issue with a minimal app that exhibits the problem? Thanks!

@pranavkm pranavkm added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Oct 12, 2020
@BrunoBlanes
Copy link
Author

Haven't updated to RC1 yet, will do it and let you know.

@ghost ghost added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Oct 12, 2020
@pranavkm
Copy link
Contributor

Thanks. Our migration notes covers changes to the project file when updating from a 3.1 project: https://docs.microsoft.com/en-us/aspnet/core/migration/31-to-50?view=aspnetcore-3.1&tabs=visual-studio#update-blazor-webassembly-projects

@BrunoBlanes
Copy link
Author

So I've gone trough the process of migrating from .NET 5 Preview 8 to RC1 and now it doesn't even clean or build.

C:\Program Files\dotnet\sdk\5.0.100-rc.1.20452.10\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(379,5): error NETSDK1082: There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'browser-wasm'.

Here is my Server project file:

<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
    <PropertyGroup>
	<TargetFramework>net5.0</TargetFramework>
	<LangVersion>preview</LangVersion>
	<Nullable>enable</Nullable>
	<OutputType>Exe</OutputType>
	<Version>0.1.0.0</Version>
	<StartupObject>CRM.Server.Program</StartupObject>
	<PreserveCompilationContext>true</PreserveCompilationContext>
	<UserSecretsId>311b3395-91d4-422a-82a7-52ea76f9e066</UserSecretsId>
	<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
	<!--<RuntimeIdentifiers>win-x86;win-x64;win-arm;linux-x64;linux-arm</RuntimeIdentifiers>-->
    </PropertyGroup>

    [...]
</Project>

Here is my Client project file:

<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
    <PropertyGroup>
	<TargetFramework>net5.0</TargetFramework>
	<LangVersion>preview</LangVersion>
	<Nullable>enable</Nullable>
    </PropertyGroup>

    [...]
</Project>

I tried repairing my .NET 5 RC1 installation and got the following error:

[3230:290C][2020-10-12T17:21:10]i301: Applying execute package: AspNetCoreSharedFramework_x64, action: Repair, path: C:\ProgramData\Package Cache\{0E6BE3E7-2AA8-3522-B71B-FEF5F4BBF1AC}v5.0.0.0\AspNetCoreSharedFramework-x64.msi, arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7" DOTNETHOME="C:\Program Files\dotnet"'
[3230:290C][2020-10-12T17:21:11]e000: Error 0x80070643: Failed to run maintanance mode for MSI package.
[3230:290C][2020-10-12T17:21:11]e000: Error 0x80070643: Failed to execute MSI package.
[2CD0:3454][2020-10-12T17:21:11]e000: Error 0x80070643: Failed to configure per-machine MSI package.
[2CD0:3454][2020-10-12T17:21:11]w348: Application requested retry of package: AspNetCoreSharedFramework_x64, encountered error: 0x80070643. Retrying...

I don't know if the above error is related, but I tried cleaning the cache folder and reinstalling .NET 5 and restarting my computer. None fixed it.

@BrunoBlanes
Copy link
Author

My dotnet --info output by the way.

C:\Users\bruno>dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.100-rc.1.20452.10
 Commit:    473d1b592e

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.20185
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.100-rc.1.20452.10\

Host (useful for support):
  Version: 5.0.0-rc.1.20451.14
  Commit:  38017c3935

.NET SDKs installed:
  5.0.100-rc.1.20452.10 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.0-rc.1.20451.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.0-rc.1.20451.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 5.0.0-rc.1.20452.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

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

@pranavkm pranavkm added Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. and removed Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. labels Oct 12, 2020
@pranavkm
Copy link
Contributor

Here is my Server project file:

Your server project file shouldn't target the WebAssembly SDK:

<!-- Server.csproj -->
- <Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
+ <Project Sdk="Microsoft.NET.Sdk.Web"> 

@BrunoBlanes
Copy link
Author

Ok, so that returns it to how it was working before, I can compile it fine on Visual Studio, but Azure Devops throws this:

##[error]/opt/hostedtoolcache/dotnet/sdk/5.0.100-rc.1.20452.10/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5): Error NETSDK1047: Assets file '/home/vsts/work/1/s/Client/obj/project.assets.json' doesn't have a target for 'net5.0/linux-x64'. Ensure that restore has run and that you have included 'net5.0' in the TargetFrameworks for your project. You may also need to include 'linux-x64' in your project's RuntimeIdentifiers.

@ghost ghost added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Oct 12, 2020
@BrunoBlanes
Copy link
Author

Oh, wait, never mind, I was looking at the wrong build. It passed.

@pranavkm pranavkm added ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. and removed affected-most This issue impacts most of the customers bug This issue describes a behavior which is not expected - a bug. severity-blocking This label is used by an internal tool labels Oct 12, 2020
@ghost ghost added the Status: Resolved label Oct 12, 2020
ASP.NET Core Blazor & MVC 5.0.x automation moved this from 5.0 GA to Done Oct 12, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Nov 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. Status: Resolved
Projects
No open projects
Development

No branches or pull requests

10 participants