question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Blazor Wasm App publish is failing with '--self-contained false --runtime linux-arm' on missing DotNetJsVersion

See original GitHub issue

Describe the bug

dotnet publish of a new Blazor Wasm app with parameters --self-contained false --runtime linux-arm is failing because of missing DotNetJsVersion in ComputeBlazorPublishAssets task

The only reference that I could find for DotNetJsVersion is in this PR dotnet/sdk#21919 so maybe there is some connection to the error I am getting

I am using the latest version of Visual Studio (17.0.4) and .NET (6.0.101)

To Reproduce

  1. Create new Blazor Wasm project in Visual Studio with default settings

obrazek

  1. Add <PublishTrimmed>false</PublishTrimmed> to csproj to avoid error NETSDK1102
  2. run dotnet publish --self-contained false --configuration debug --runtime linux-arm

Exceptions (if any)

C:\Program Files\dotnet\sdk\6.0.101\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets(412,5): error MSB4044: The "ComputeBlazorPublishAssets" task was not given a value for the required parameter "DotNetJsVersion". [C:\Source\Projects\BlazorPublishIssue\BlazorPublishIssue.csproj]

Further technical details

Visual Studio 17.0.4

dotnet --info .NET SDK (reflecting any global.json): Version: 6.0.101 Commit: ef49f6213a

Runtime Environment: OS Name: Windows OS Version: 10.0.22000 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\6.0.101\

Host (useful for support): Version: 6.0.1 Commit: 3a25a7f1cc

.NET SDKs installed: 3.1.415 [C:\Program Files\dotnet\sdk] 5.0.401 [C:\Program Files\dotnet\sdk] 5.0.403 [C:\Program Files\dotnet\sdk] 6.0.101 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
pranavkmcommented, Jan 3, 2022

I guess the Blazor SDK has to mark SelfContained as a private property. You have a couple of options to resolve this:

a) You can avoid specifying --self-contained false as a publish option since it’s false by default for the hosted app. b) You could modify the wasm app to ignore the value of SelfContained specified from the CLI:

- <Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
+ <Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly" TreatAsLocalProperty="SelfContained">

  <PropertyGroup>
+    <SelfContained>true</SelfContained>
  </PropertyGroup>
0reactions
KhoaDQcommented, May 29, 2023

I guess the Blazor SDK has to mark SelfContained as a private property. You have a couple of options to resolve this:

a) You can avoid specifying --self-contained false as a publish option since it’s false by default for the hosted app. b) You could modify the wasm app to ignore the value of SelfContained specified from the CLI:

- <Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
+ <Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly" TreatAsLocalProperty="SelfContained">

  <PropertyGroup>
+    <SelfContained>true</SelfContained>
  </PropertyGroup>

I solved it, thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can not publish Blazor wasm to azure anymore
Edit: I've tried to publish my project to a folder and got the same error. So no relation to azure. Then I've created...
Read more >
publishing Blazor WASM project to folder fails : RIDER-71884
If you add a 'Publish to Folder' configuration (unchanged) to a fresh (empty) Blazor WASM project, the configuration fails with the following error:....
Read more >
Host and deploy ASP.NET Core Blazor WebAssembly
The property can't be set correctly with the dotnet publish command using the --no-self-contained option or the MSBuild property /p: ...
Read more >
Untitled
Speed of dotnet run vs the speed of dotnet for published apps (plus … ... false --runtime linux-arm is failing because of missing...
Read more >
https://raw.githubusercontent.com/dotnet/aspnetcor...
Sdk.BlazorWebAssembly.targets WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have created a backup copy. Incorrect changes ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found