##[error]dotnet command failed with non-zero exit code on the following projects

Code Example - ##[error]dotnet command failed with non-zero exit code on the following projects

                
                        edit your.csproj and add MvcRazorCompileOnPublish as false

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext>
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
</PropertyGroup>