Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET CORE 2.1 Preview "SharedCompilationId" parameter is not supported by the "Csc" task

I am trying run the project with views in separate class library on Mac OSX as described in below article

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

The problem is that I cannot build the class library project with Visual Studio Community 7.4 on Mac OS.

Project builds with command line (donet build) without problems but when I try to build it with Visual Studio it throws two errors:

/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)

When I change RazorCompileOnBuild to false or remove Content from Content Build project compiles without errors.

like image 656
macfly Avatar asked Mar 08 '18 12:03

macfly


4 Answers

Go to Nuget Console and add:

Install-Package Microsoft.Net.Compilers -Version 2.8.2

You will no longer get above mentioned error.

like image 158
MrNams Avatar answered Jan 18 '23 23:01

MrNams


I had this problem on the build server but not locally.

The solution: Install the updated Visual Studio on the build server. In my case 2017.15.4

like image 30
Dave Loukola Avatar answered Jan 18 '23 23:01

Dave Loukola


As I find you can solve this issue in two ways.

Solution 1

Add Microsoft.Net.Compilers compilers package to the project.

Solution 2

Build the project using the command line. dotnet build

like image 45
CuriousGuy Avatar answered Jan 18 '23 23:01

CuriousGuy


In my case, I had installed the .NET Core 2.1 SDK, but not the runtime.

Strange how Microsoft don't include the runtime in the SDK.

like image 31
Jessica Avatar answered Jan 19 '23 01:01

Jessica