问题
I'm getting this error:
enter code here
System.TypeLoadException: Could not resolve type with token 0100001a from typeref (expected class 'System.Threading.Tasks.Task' in assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
When I switch to:
<TargetFramework>netcoreapp3.1</TargetFramework>
or
<TargetFramework>netcoreapp5.0</TargetFramework>
from netstandard2.1
My packages are:
<PackageReference Include="Blazored.LocalStorage" Version="2.1.5" />
<PackageReference Include="Blazorise" Version="0.9.0.2" />
<PackageReference Include="Blazorise.Bulma" Version="0.9.0.2" />
<PackageReference Include="Blazorise.Components" Version="0.9.0.2" />
<PackageReference Include="Blazorise.DataGrid" Version="0.9.0.2" />
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="0.9.0.2" />
<PackageReference Include="Blazorise.Sidebar" Version="0.9.0.2" />
<PackageReference Include="Blazorise.Snackbar" Version="0.9.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="3.2.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="3.2.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0-preview.4.20251.6" />
<PackageReference Include="System.Net.Http.Json" Version="5.0.0-preview.4.20251.6" />
<PackageReference Include="Toolbelt.Blazor.I18nText" Version="9.0.1.1" />
<PackageReference Include="Toolbelt.Blazor.SpeechRecognition" Version="0.0.4.6-alpha" />
<PackageReference Include="Toolbelt.Blazor.SpeechSynthesis" Version="8.0.0" />
Any ideas to resolve this problem?
ps. I was supprised that it is working properly in samples like here: https://channel9.msdn.com/Events/Build/2020/BOD104
回答1:
I think, this question has been answered here:
Blazor WebAssembly 3.1 Target Framework is missing
This is OK. This is the latest version of Blazor WebAssembly App: .NETStandard 2.1
A Blazor WebAssembly App, unlike Balzor Server App , runs under the Mono runtime. It is not .Net Core.
来源:https://stackoverflow.com/questions/61931707/blazor-wasm-system-typeloadexception-could-not-resolve-type-with-token-010000