aspnetcore: EXEC : error : Could not load type 'System.Text.Json.Serialization.JsonSerializerOptions' from assembly 'System.Text.Json, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.

From @vikramtamboli on Monday, August 12, 2019 5:30:09 AM

Hi Team,

We are trying to compile source from https://github.com/SteveSandersonMS/presentation-2019-06-NDCOslo/tree/master/demos/MissionControl

When we run below command we get exception D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Server>dotnet build

Microsoft ® Build Engine version 16.3.0-preview-19329-01+d31fdbf01 for .NET Core Copyright © Microsoft Corporation. All rights reserved.

D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Client\MissionControl.Client.csproj : warning NU1603: RazorComponents.MaterialDesign 0.1.0-alpha-20190610102728 depends on Microsoft.AspNetCore.Components.Browser (>= 3.0.0-preview6.19305.13) but Microsoft.AspNetCore.Components.Browser 3.0.0-preview6.19305.13 was not found. An approximate best match of Microsoft.AspNetCore.Components.Browser 3.0.0-preview6.19307.2 was resolved. [D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Server\MissionControl.Server.csproj] Restore completed in 108.36 ms for D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Client\MissionControl.Client.csproj. D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Server\MissionControl.Server.csproj : warning NU1603: RazorComponents.MaterialDesign 0.1.0-alpha-20190610102728 depends on Microsoft.AspNetCore.Components.Browser (>= 3.0.0-preview6.19305.13) but Microsoft.AspNetCore.Components.Browser 3.0.0-preview6.19305.13 was not found. An approximate best match of Microsoft.AspNetCore.Components.Browser 3.0.0-preview6.19307.2 was resolved. Restore completed in 505.88 ms for D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Server\MissionControl.Server.csproj. Restore completed in 1.03 sec for D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\PinMapLibrary\PinMapLibrary.csproj. Restore completed in 35.97 ms for D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Shared\MissionControl.Shared.csproj. You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Server\MissionControl.Server.csproj : warning NU1603: RazorComponents.MaterialDesign 0.1.0-alpha-20190610102728 depends on Microsoft.AspNetCore.Components.Browser (>= 3.0.0-preview6.19305.13) but Microsoft.AspNetCore.Components.Browser 3.0.0-preview6.19305.13 was not found. An approximate best match of Microsoft.AspNetCore.Components.Browser 3.0.0-preview6.19307.2 was resolved. You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Client\MissionControl.Client.csproj : warning NU1603: RazorComponents.MaterialDesign 0.1.0-alpha-20190610102728 depends on Microsoft.AspNetCore.Components.Browser (>= 3.0.0-preview6.19305.13) but Microsoft.AspNetCore.Components.Browser 3.0.0-preview6.19305.13 was not found. An approximate best match of Microsoft.AspNetCore.Components.Browser 3.0.0-preview6.19307.2 was resolved. MissionControl.Shared -> D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Shared\bin\Debug\netstandard2.0\MissionControl.Shared.dll PinMapLibrary -> D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\PinMapLibrary\bin\Debug\netstandard2.0\PinMapLibrary.dll MissionControl.Client -> D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Client\bin\Debug\netstandard2.0\MissionControl.Client.dll EXEC : error : Could not load type ‘System.Text.Json.Serialization.JsonSerializerOptions’ from assembly ‘System.Text.Json, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’. [D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Client\MissionControl.Client.csproj] at Microsoft.AspNetCore.Blazor.Build.BootJsonWriter.GetBootJsonContent(String assemblyFileName, String entryPoint, String[] assemblyReferences, IEnumerable`1 embeddedContent, Boolean linkerEnabled) at Microsoft.AspNetCore.Blazor.Build.BootJsonWriter.WriteFile(String assemblyPath, String[] assemblyReferences, String[] embeddedResourcesSources, Boolean linkerEnabled, String outputPath) at Microsoft.AspNetCore.Blazor.Build.DevServer.Commands.WriteBootJsonCommand.<>c__DisplayClass0_0.b__0() C:\Users\349185.nuget\packages\microsoft.aspnetcore.blazor.build\3.0.0-preview6.19307.2\targets\Blazor.MonoRuntime.targets(633,5): error MSB3073: The command “dotnet “C:\Users\349185.nuget\packages\microsoft.aspnetcore.blazor.build\3.0.0-preview6.19307.2\targets…/tools/Microsoft.AspNetCore.Blazor.Build.dll” write-boot-json “obj\Debug\netstandard2.0\MissionControl.Client.dll” --references “D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Client\obj\Debug\netstandard2.0\blazor\bootjson-references.txt” --embedded-resources “D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Client\obj\Debug\netstandard2.0\blazor\embedded.resources.txt” --linker-enabled --output “D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Client\obj\Debug\netstandard2.0\blazor\blazor.boot.json”” exited with code 1. [D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Client\MissionControl.Client.csproj]

Build FAILED.

D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Client\MissionControl.Client.csproj : warning NU1603: RazorComponents.MaterialDesign 0.1.0-alpha-20190610102728 depends on Microsoft.AspNetCore.Components.Browser (>= 3.0.0-preview6.19305.13) but Microsoft.AspNetCore.Components.Browser 3.0.0-preview6.19305.13 was not found. An approximate best match of Microsoft.AspNetCore.Components.Browser 3.0.0-preview6.19307.2 was resolved. [D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Server\MissionControl.Server.csproj] D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Server\MissionControl.Server.csproj : warning NU1603: RazorComponents.MaterialDesign 0.1.0-alpha-20190610102728 depends on Microsoft.AspNetCore.Components.Browser (>= 3.0.0-preview6.19305.13) but Microsoft.AspNetCore.Components.Browser 3.0.0-preview6.19305.13 was not found. An approximate best match of Microsoft.AspNetCore.Components.Browser 3.0.0-preview6.19307.2 was resolved. D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Server\MissionControl.Server.csproj : warning NU1603: RazorComponents.MaterialDesign 0.1.0-alpha-20190610102728 depends on Microsoft.AspNetCore.Components.Browser (>= 3.0.0-preview6.19305.13) but Microsoft.AspNetCore.Components.Browser 3.0.0-preview6.19305.13 was not found. An approximate best match of Microsoft.AspNetCore.Components.Browser 3.0.0-preview6.19307.2 was resolved. D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Client\MissionControl.Client.csproj : warning NU1603: RazorComponents.MaterialDesign 0.1.0-alpha-20190610102728 depends on Microsoft.AspNetCore.Components.Browser (>= 3.0.0-preview6.19305.13) but Microsoft.AspNetCore.Components.Browser 3.0.0-preview6.19305.13 was not found. An approximate best match of Microsoft.AspNetCore.Components.Browser 3.0.0-preview6.19307.2 was resolved. EXEC : error : Could not load type ‘System.Text.Json.Serialization.JsonSerializerOptions’ from assembly ‘System.Text.Json, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’. [D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Client\MissionControl.Client.csproj] C:\Users\349185.nuget\packages\microsoft.aspnetcore.blazor.build\3.0.0-preview6.19307.2\targets\Blazor.MonoRuntime.targets(633,5): error MSB3073: The command “dotnet “C:\Users\349185.nuget\packages\microsoft.aspnetcore.blazor.build\3.0.0-preview6.19307.2\targets…/tools/Microsoft.AspNetCore.Blazor.Build.dll” write-boot-json “obj\Debug\netstandard2.0\MissionControl.Client.dll” --references “D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Client\obj\Debug\netstandard2.0\blazor\bootjson-references.txt” --embedded-resources “D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Client\obj\Debug\netstandard2.0\blazor\embedded.resources.txt” --linker-enabled --output “D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Client\obj\Debug\netstandard2.0\blazor\blazor.boot.json”” exited with code 1. [D:\Workspaces\presentation-2019-06-NDCOslo-master\demos\MissionControl\MissionControl.Client\MissionControl.Client.csproj] 4 Warning(s) 2 Error(s)

Time Elapsed 00:00:13.34

Copied from original issue: dotnet/corefx#40241

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 21 (10 by maintainers)

Most upvoted comments

@markgr your project’s referencing the Microsoft.AspNetCore.ProtectedBrowserStorage package that hasn’t been updated to be be compiled against the RTM version of .NET Core. We’ll use a separate issue to track fixing it. Note that the package is experimental and isn’t actively supported.

@dtate22 it’s not clear what’s causing the issue, but it’s most likely an out-of-date reference. I may be mistaken, but I don’t think .NET Core 3.0 is supported on Azure Functions as yet, I’m not sure if using ASP.NET Core 3.0 with it is going to ultimately succeed at this point.

Generally you should only see this error if you’re referencing a package \ library that was compiled against a preview build of .NET Core or the System.Text.Json package. Since 3.0 is now RTM, we anticipate library authors to rebuild against the RTM versions of the framework which should resolve this issue.

If you’re still seeing this issue, please file separate issues possibly with a minimal repro app.

Also, I will say this, I’m using Azure functions to code my solution and the code ONLY breaks in the Visual Studio Azure functions testing harness.

@dtate22, The Azure Functions host pins the assembly version it loads and since it generally lags behind the latest releases, you’d see type mismatch/missing issue until AF catches to the latest version of .NET Core - this is a known issue specific to AF - feel free to follow up on https://github.com/Azure/azure-functions-host

See related issues: https://github.com/Azure/azure-functions-host/issues/4906 / https://github.com/Azure/azure-functions-host/issues/5031

From https://github.com/Azure/azure-functions-host/issues/5031#issuecomment-539117007

We’ll have a preview (with a supporting version of the CLI) available very soon. Please keep an eye on the announcement @espray linked above as we’ll update it once those bits become available.