pesho hristov
pesho hristov

Reputation: 2060

Blazor on Linux: Error Could not load file or assembly System.Runtime

I am on OpenSUSE Tumbleweed and installed Blazor from this page:

https://learn.microsoft.com/en-us/dotnet/core/install/ (Downloaded the specific tar.gz files from here: https://dotnet.microsoft.com/download/dotnet-core/3.0)

And now when I run dotnet --version I get 3.0.101.

So I added the Blazor template like this:

dotnet new -i Microsoft.AspNetCore.Blazor.Templates::3.1.0-preview4.19579.2

And tried to create a project like this:

dotnet new blazorwasm -o BlazorDemo
cd BlazorDemo
dotnet run

The project got created, however - upon running I get this error:

/home/petar/.nuget/packages/microsoft.aspnetcore.blazor.build/3.1.0-preview4.19579.2/targets/Blazor.MonoRuntime.targets(151,5): error MSB4062: The "BlazorCreateRootDescriptorFile" task could not be loaded from the assembly /home/petar/.nuget/packages/microsoft.aspnetcore.blazor.build/3.1.0-preview4.19579.2/targets/../tools/netcoreapp/Microsoft.AspNetCore.Blazor.Build.Tasks.dll. Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. [/home/petar/Blazor/BlazorDemo/BlazorDemo.csproj]
/home/petar/.nuget/packages/microsoft.aspnetcore.blazor.build/3.1.0-preview4.19579.2/targets/Blazor.MonoRuntime.targets(151,5): error MSB4062:  Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [/home/petar/Blazor/BlazorDemo/BlazorDemo.csproj]

The build failed. Fix the build errors and run again.

Any idea what could the problem be?

Upvotes: 0

Views: 776

Answers (1)

pesho hristov
pesho hristov

Reputation: 2060

As Agua mentioned - I was using the .NET 3.0. but I was using the template for 3.1.

So - I deleted the dotnet folder and installed again the correct version:

  1. This tutorial - https://learn.microsoft.com/en-us/dotnet/core/install/sdk?pivots=os-linux
  2. Download page - https://learn.microsoft.com/en-us/dotnet/core/install/sdk?pivots=os-linux#all-net-core-downloads

And now I'm able to run Blazor on an unsupported Linux distro :)

Upvotes: 1

Related Questions