.Net core 2 Publish error

Hi! At the time of publishing packages ServiceStack I get the following error for the web project if it’s not a web project there are no mistakes.

C:\Users\Mher\.nuget\packages\microsoft.aspnetcore.mvc.razor.viewcompilation\2.0.0\build\netstandard2.0\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets(60,5): error MSB3073: The command ""C:\Program Files\dotnet\dotnet.exe" exec --runtimeconfig "d:\Documents\TFSWorkspace\BotOld\BotActivator\bin\Debug\netcoreapp2.0\App.runtimeconfig.json" --depsfile "d:\Documents\TFSWorkspace\BotOld\BotActivator\bin\Debug\netcoreapp2.0\App.deps.json" "C:\Users\Mher\.nuget\packages\microsoft.aspnetcore.mvc.razor.viewcompilation\2.0.0\build\netstandard2.0\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.dll" @"obj\Debug\netcoreapp2.0\microsoft.aspnetcore.mvc.razor.viewcompilation.rsp"" exited with code 1. [d:\Documents\TFSWorkspace\BotOld\BotActivator\App.csproj]

It’s a project file.

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <AssemblyName>App</AssemblyName>
    <PackageId>App</PackageId>
    <PreserveCompilationContext>false</PreserveCompilationContext>
  </PropertyGroup>

  <ItemGroup>
    <None Update="wwwroot\**\*">
      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
    </None>
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="MailKit" Version="1.18.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
    <PackageReference Include="ServiceStack.OrmLite.MySql.Core" Version="1.0.45" />
    <PackageReference Include="ServiceStack.Redis.Core" Version="1.0.45" />

    <PackageReference Include="ServiceStack.Text.Core" Version="1.0.45" />
    <PackageReference Include="ServiceStack.Interfaces.Core" Version="1.0.45" />
    <PackageReference Include="ServiceStack.Client.Core" Version="1.0.45" />
    <PackageReference Include="ServiceStack.Common.Core" Version="1.0.45" />
    <PackageReference Include="ServiceStack.Core" Version="1.0.45" />
    <PackageReference Include="Telegram.Bot" Version="13.2.1" />

  </ItemGroup>

</Project>

The package cache nuget cleaned, does not help, what could be the problem? how can it be solved? Thank you!

This is a .NET Core Publish error, it’s not something ServiceStack libraries has any control over. You’d need to submit an issue with ASP.NET Core team or ask on StackOverflow to see if anyone knows.

The error message suggests the compilation of MVC Razor Views is failing, if this is not an MVC App you can disable MVC pre-compilation of Razor Views with:

dotnet publish -c Release /p:MvcRazorCompileOnPublish=false
1 Like