Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assembly location for Razor SDK Tasks was not specified

My project fails to build on a build server. I recently added a new ASP.Net Core (2.2) MVC project with razor pages. The project and the rest of the solution target the .Net Framework 4.7.2.

In Visual Studio on my dev-machine this works fine, but the build server cannot build it. It shows this error.

C:\Users\tfs-build.nuget\packages\microsoft.aspnetcore.razor.design\2.2.0\build\netstandard2.0\Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets(161):C:\Users\tfs-build.nuget\packages\microsoft.aspnetcore.razor.design\2.2.0\build\netstandard2.0\Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets(161,5): Error : Assembly location for Razor SDK Tasks was not specified. The most likely cause is an older incompatible version of Microsoft.NET.Sdk.Razor, or Microsoft.NET.Sdk.Web used by this project. Please target a newer version of the .NET Core SDK.

I made my coworker install the .Net Core SDK 2.2, since I remembered installing that on the dev-machine to be able to create the project. But this did not help on the buildserver.

What could cause this? Why is the behaviour different from the development environment?

like image 616
Tigerware Avatar asked Apr 11 '19 13:04

Tigerware


People also ask

What is razor SDK?

Razor MSBuild SDK (Razor SDK). The Razor SDK: Is required to build, package, and publish projects containing Razor files for ASP.NET Core MVC-based or Blazor projects.

What is Microsoft NET SDK Web?

Microsoft. NET. Sdk. Web is an MSBuild project SDK for building ASP.NET Core apps.

What is Microsoft ASP.NET Core app?

The ASP.NET Core shared framework ( Microsoft. AspNetCore. App ) contains assemblies that are developed and supported by Microsoft. Microsoft.

What is Microsoft ASP.NET Core razor design?

AspNetCore. Razor. Design contains MSBuild support for Razor. If you're developing an asp.net core app, there's no need to add an package reference on Microsoft.


1 Answers

It worked on the build server, after I added this Nuget package:

Microsoft.NET.Sdk.Razor

Since I added the Net.SDK.Razor package, it builds successfully.

I had also added Microsoft.AspNetCore.Razor.Design, but only Microsoft.NET.Sdk.Razor is actually needed.

like image 167
Tigerware Avatar answered Sep 20 '22 07:09

Tigerware