macos – ASP.NET CORE 2.1预览“Csc”任务不支持“SharedCompilationId”参数

我正在尝试使用Mac OSX上单独的类库中的视图运行项目,如下文所述

https://blogs.msdn.microsoft.com/webdev/2018/03/01/asp-net-core-2-1-razor-ui-in-class-libraries/

问题是我无法在Mac OS上使用Visual Studio Community 7.4构建类库项目.

项目使用命令行(donet build)构建没有问题,但是当我尝试使用Visual Studio构建它时,它会抛出两个错误:

/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.aspnetcore.razor.design/2.1.0-preview1-final/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.Compilation.targets(10,10): Error MSB4064: The "SharedCompilationId" parameter is not supported by the "Csc" task. Verify the parameter exists on the task,and it is a settable public instance property. (MSB4064)

/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.aspnetcore.razor.design/2.1.0-preview1-final/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.Compilation.targets(5,5): Error MSB4063: The "Csc" task could not be initialized with its input parameters. (MSB4063)

当我将RazorCompileOnBuild更改为false或从Content Build项目中删除内容时,编译没有错误.

解决方法

转到Nuget控制台并添加:

安装包Microsoft.Net.Compilers -Version 2.8.2

您将不再获得上述错误.

相关文章

本文将从上往下,循序渐进的介绍一系列相关.NET的概念,先从...
基于 .NET 的一个全新的、好用的 PHP SDK + Runtime: Pe...
.NET 异步工作原理介绍。
引子 .NET 6 开始初步引入 PGO。PGO 即 Profile Guided Opti...
前言 2021/4/8 .NET 6 Preview 3 发布,这个版本的改进大多来...
前言 开头防杠:.NET 的基础库、语言、运行时团队从来都是相...