Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Error During dotnet build in VSTS CI/CD error : rzc generate exited with code 1

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.

like image 645
user2021740 Avatar asked Jan 11 '19 09:01

user2021740


1 Answers

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

like image 133
T S Taylor Avatar answered Nov 12 '22 23:11

T S Taylor