Blazor Client problem with mscorlib.dll / mono-runtime

Viewed 1490

I have project created with an blazorhosted template.

Yesterday for some reason Client side had problem with compiling due to like 500 characters error message

I clicked on it twice, and it opened iirc something like mono runtime config file in C:\ProgramFiles\dotnet\...\0.7 folder with weird lines like {blazor smth} and I removed something and unfortunely saved that and went sleep...

I also remember that that 500 characters long error mentioned Linker

Now after starting my app it just shows "Loading..." page and error on web browser console

WASM: The assembly mscorlib.dll was not found or could not be loaded. blazor.webassembly.js:1:32055 WASM: It should have been installed in the `/mnt/jenkins/workspace/test-mono-mainline-wasm/label/ubuntu-1804-amd64/sdks/out/wasm-runtime-release/lib/mono/4.5/mscorlib.dll' directory. blazor.webassembly.js:1:32055 Error: Failed to start platform. Reason: [object XMLHttpRequest]

I totally understand that it may be hard to debug it, but maybe somebody has an idea? or how can I reinstall or repair Blazor / Mono?

I just downloaded and installed .NET Core 3.0 (previously had 2.x)

But still the above mentioned error occurs.

2 Answers

If you want use Blazor with .NET Core 3.0 (at least Preview 2) then you essentially use Razor Components + Blazor. It require for you use version of Blazor only from dev feed and not from official Nuget which will work just on .NET Core 2.1 (not on 2.2).

In order to use Blazor with .NET Core 3.0 you should add following changes to your project

  1. Add RestoreAdditionalProjectSources property
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <OutputType>Exe</OutputType>
    <LangVersion>7.3</LangVersion>
    <RestoreAdditionalProjectSources>
      https://dotnet.myget.org/F/dotnet-core/api/v3/index.json;
      https://dotnet.myget.org/f/blazor-dev/api/v3/index.json;
    </RestoreAdditionalProjectSources>
  </PropertyGroup>
  1. Change Blazor references to
<ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Blazor" Version="0.8.0-preview-19075-0444" />
    <PackageReference Include="Microsoft.AspNetCore.Components.Browser" Version="3.0.0-preview-19075-0444" />
    <PackageReference Include="Microsoft.AspNetCore.Components.Build" Version="3.0.0-preview-19075-0444" />
    <PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="0.8.0-preview-19075-0444" PrivateAssets="all" />
  </ItemGroup>

For me that happened when i edited index.html with some changes (page title and footer) it started with this strange error. Not sure maybe had an error in html... Well, reverted index.html back to when it was working, the error was gone.

Related