问题描述
使用CI/CD构建dotnet mvc应用程序时出现错误.
I am getting an error while using CI/CD to build dotnet mvc application.
C:\ Program 文件\ dotnet \ sdk \ NuGetFallbackFolder \ microsoft.aspnetcore.razor.design \ 2.1.1 \ build \ netstandard2.0 \ Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets(121,5): 错误:rzc生成已退出,代码为1.[D:\ a \ 1 \ s \ x.csproj]错误: rzc generate退出,代码为1.
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.
推荐答案
在使用我们的标准构建模板基于dotnet角度spa模板构建新项目之后,我对此感到一阵子.
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.
令人困惑的是,没有剃须刀页面的项目的dotnet生成任务会将其标记为警告并继续执行(特别是在Azure Devops UI中不会引发警告).这导致我错误地认为丢失的参数是红色鲱鱼.
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.
解决方案
进入管道设置的变量选项卡,并添加一个名为BuildConfiguration
的新管道变量,其值为Debug
或Release
(取决于您要构建的内容).
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).
这篇关于在VSTS CI/CD中的dotnet生成期间遇到错误:rzc generate已退出,代码为1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!