2

I've start to develop a web application with ASP.NET Core 3 and Blazor framework. During few days/weeks, I could build my application. Since preview 5 announced, I couldn't build my application (with dotnet build command). I've the next error:

C:\Users\a\.nuget\packages\microsoft.aspnetcore.blazor.build\3.0.0-preview5-19227-01\targets\Blazor.MonoRuntime.targets(439,5): error MSB3073: The command "dotnet "" -l    
-o "D:\Repos\IdeaStudio.Website.Client\obj\Debug\netstandard2.0\linker/" 
-x "C:\Users\a\.nuget\packages\microsoft.aspnetcore.blazor.build\3.0.0-preview5-19227-01\targets\BuiltInBclLinkerDescriptor.xml" 
-x "D:\Repos\IdeaStudio.Website.Client\obj\Debug\netstandard2.0\linker.descriptor.xml" 
-a "C:\Users\a\.nuget\packages\microsoft.aspnetcore.blazor\3.0.0-preview5-19227-01\lib\netstandard2.0\Microsoft.AspNetCore.Blazor.dll" 
-a "C:\Users\a\.nuget\packages\microsoft.aspnetcore.components\3.0.0-preview5-19227-01\lib\netstandard2.0\Microsoft.AspNetCore.Components.dll" 
-a "C:\Users\a\.nuget\packages\microsoft.aspnetcore.components.browser\3.0.0-preview5-19227-01\lib\netstandard2.0\Microsoft.AspNetCore.Components.Browser.dll" 
-a "C:\Users\a\.nuget\packages\microsoft.extensions.dependencyinjection\3.0.0-preview5.19227.9\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.dll" 
-a "C:\Users\a\.nuget\packages\microsoft.extensions.dependencyinjection.abstractions\3.0.0-preview5.19227.9\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll" 
-a "C:\Users\a\.nuget\packages\microsoft.jsinterop\3.0.0-preview5.19227.9\lib\netstandard2.0\Microsoft.JSInterop.dll" 
-a "C:\Users\a\.nuget\packages\mono.webassembly.interop\3.0.0-preview5.19227.9\lib\netstandard2.0\Mono.WebAssembly.Interop.dll" 
-a "C:\Users\a\.nuget\packages\system.componentmodel.annotations\4.6.0-preview5.19224.8\lib\netstandard2.0\System.ComponentModel.Annotations.dll" 
-a "D:\Repos\IdeaStudio.Website.Client\obj\Debug\netstandard2.0\IdeaStudio.Website.Client.dll"" exited with code 1. 
[D:\Repos\IdeaStudio.Website.Client\IdeaStudio.Website.Client.csproj]

My csproj looks like :

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <RestoreAdditionalProjectSources>
      https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json;
      https://dotnet.myget.org/F/blazor-dev/api/v3/index.json;
    </RestoreAdditionalProjectSources>
    <LangVersion>7.3</LangVersion>
    <RazorLangVersion>3.0</RazorLangVersion>
    <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <OutputType>Exe</OutputType>
    <TargetFrameworks>netstandard2.0</TargetFrameworks>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.5.1" />
    <PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview5-19227-01" />
    <PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.0.0-preview5-19227-01" PrivateAssets="all" />
    <PackageReference Include="Microsoft.AspNetCore.Blazor.DevServer" Version="3.0.0-preview5-19227-01" PrivateAssets="all" />
  </ItemGroup>
</Project>

I did not understand for several days until...

3
  • Which command did you run? Commented May 28, 2019 at 15:28
  • @MindSwipe dotnet build Commented May 28, 2019 at 15:30
  • 1
    This GitHub issue for mono (the runtime for blazor) tracks this error code. Someone was able to fix it by adding <BlazorLinkOnBuild>false</BlazorLinkOnBuild> to the ProertyGroup tag in the csproj Commented May 28, 2019 at 15:34

3 Answers 3

3

This issue on the Mono GitHub is related.

Basically, as far as I understand it, somewhere in Mono the IL Linker fails and throws this cryptic error message. We can see hints to this in your error message.

As of now, michaelccote on GitHub solved the problem by adding the <BlazorLinkOnBuild>false</BlazorLinkOnBuild> element inside the <PropertyGroup>...</PropertyGroup> tags of the .csproj file

Sign up to request clarification or add additional context in comments.

1 Comment

Which .csproj-File? *.Server or *.Client?
1

Maybe when I did the Visual Studio / .NET Core 3 preview 5

dotnet cli can't build an application with a csproj which contains <TargetFramework> and <TargetFrameworks> properties...

Comments

0

When you are using Blazor WebAssembly, ASP.NET Core 3.1 please navigate to yoursolution/yourproject.Client/ and edit yourproject.Client.csproj-File. Add the following line:

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    [...]
    <BlazorWebAssemblyEnableLinking>false</BlazorWebAssemblyEnableLinking>
  </PropertyGroup>
  [...]
</Project>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.