简体   繁体   English

Asp.Net Core 3 的构建失败(Blazor 客户端)

[英]Build fail for Asp.Net Core 3 (Blazor client side)

I've start to develop a web application with ASP.NET Core 3 and Blazor framework.我已经开始使用 ASP.NET Core 3 和 Blazor 框架开发 Web 应用程序。 During few days/weeks, I could build my application.在几天/几周内,我可以构建我的应用程序。 Since preview 5 announced, I couldn't build my application (with dotnet build command).自预览版 5 发布以来,我无法构建我的应用程序(使用dotnet build命令)。 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 :我的csproj看起来像:

<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...搞了好几天没看懂。。。

This issue on the Mono GitHub is related. Mono GitHub 上的这个问题是相关的。

Basically, as far as I understand it, somewhere in Mono the IL Linker fails and throws this cryptic error message.基本上,据我所知,在 Mono 的某个地方,IL 链接器失败并抛出这个神秘的错误消息。 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截至目前,GitHub 上的 michaelccote 通过在 .csproj 文件的<PropertyGroup>...</PropertyGroup>标签中添加<BlazorLinkOnBuild>false</BlazorLinkOnBuild>元素解决了该问题

Maybe when I did the Visual Studio / .NET Core 3 preview 5也许当我做 Visual Studio / .NET Core 3 预览 5

dotnet cli can't build an application with a csproj which contains <TargetFramework> and <TargetFrameworks> properties... dotnet cli无法使用包含<TargetFramework><TargetFrameworks>属性的 csproj 构建应用程序...

When you are using Blazor WebAssembly, ASP.NET Core 3.1 please navigate to yoursolution/yourproject.Client/ and edit yourproject.Client.csproj -File.当你使用 Blazor WebAssembly、ASP.NET Core 3.1 时,请导航到yoursolution/yourproject.Client/并编辑yourproject.Client.csproj Add the following line:添加以下行:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Blazor WASM Asp.net 核心是否托管 = Blazor 服务器端? - Is Blazor WASM Asp.net core Hosted = Blazor server side? 将客户端 Blazor 添加到现有的 Asp.Net Core 3.1 应用程序 - Add client-side Blazor to existing Asp.Net Core 3.1 App Blazor,ASP.NET Core 托管与 ASP.NET Core 中的服务器端 - Blazor, ASP.NET Core Hosted vs Server Side in ASP.NET Core 在字段级别禁用 asp.net core 中的客户端验证 - Disable client side validation in asp.net core at field level 自定义客户端验证未在 ASP.NET 内核中触发 - Custom Client-Side Validation not triggering in ASP.NET Core ASP.NET 核心富文本编辑器 devexpress blazor - ASP.NET Core richtexteditor devexpress blazor IExceptionFilter 处理程序在 ASP.NET Core 3.1 Blazor(服务器端)中不起作用 - IExceptionFilter handler not working in ASP.NET Core 3.1 Blazor (server-side) Blazor ASP.Net Core(服务器端)中的自定义 URL 重写规则在使用导航链接时不会触发 - Custom URL rewrite rule in Blazor ASP.Net Core (server-side) not triggering when using navlink ASP.NET 核心托管和服务器端 Blazor 有什么区别,真的吗? - What's the difference between ASP.NET Core Hosted and Server-Side Blazor, really? 是否可以在ASP.NET Core MVC应用程序中运行Blazor客户端页面? - Is it possible to run a Blazor client page within an ASP.NET Core MVC App?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM