Getting Error During dotnet build in VSTS CI/CD er

2019-05-18 13:23发布

I am getting an error while using CI/CD to build dotnet mvc application.

C:\Program Files\dotnet\sdk\2.1.402\Roslyn\Microsoft.CSharp.Core.targets(52,5): warning MSB3052: The parameter to the compiler is invalid, '/define:$(BUILDCONFIGURATION)' will be ignored. [D:\a\1\s\x.csproj]

C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.razor.design\2.1.1\build\netstandard2.0\Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets(121,5): error : rzc generate exited with code 1. [D:\a\1\s\x.csproj] error : rzc generate exited with code 1.

While it working in my local machine.

1条回答
ゆ 、 Hurt°
2楼-- · 2019-05-18 13:55

I was banging my head against this for a while after using our standard build template to build a new project based on the dotnet angular spa template.

What this comes down to is the build target for razor pages requiring an explicit build configuration to be provided, thus any project containing razor pages fails without one.

Confusingly, a dotnet build task for a project with no razor pages will flag it as a warning and continue (notably without raising a warning in the Azure Devops UI). This lead me to the erroneous assumption that the missing parameter was a red herring.

Solution

Go into the variables tab of the pipeline settings and add a new pipeline variable named BuildConfiguration with value either Debug or Release (depending on what you're building).

查看更多
登录 后发表回答