- echo $MSBUILD_PATH
- cd $MSBUILD_PATH
- msbuild.exe "Daiv_OA.Web\Daiv_OA.Web.csproj" -o $DAIV_OA_WEB_OUTPUT_DIR # 直接输入msbuild.exe的文件名
- echo "Compile complete."
提示如下:
$ cd $MSBUILD_PATH
$ msbuild.exe "Daiv_OA.Web\Daiv_OA.Web.csproj" -o $DAIV_OA_WEB_OUTPUT_DIR
msbuild.exe : The term 'msbuild.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:297 char:1
+ msbuild.exe "Daiv_OA.Web\Daiv_OA.Web.csproj" -o $DAIV_OA_WEB_OUTPUT_D ...
+ ~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (msbuild.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
正确的方式:
build-job:
stage: build
tags:
- zhongfang-windows
script:
- echo "Compiling the code..."
- echo $DAIV_OA_WEB_OUTPUT_DIR
- echo $MSBUILD_PATH
- cd $MSBUILD_PATH
- .\msbuild.exe "Daiv_OA.Web\Daiv_OA.Web.csproj" -o $DAIV_OA_WEB_OUTPUT_DIR # 前边加上了“.\”
- echo "Compile complete."
作业日志如下:
$ cd $MSBUILD_PATH
$ .\msbuild.exe "Daiv_OA.Web\Daiv_OA.Web.csproj" -o $DAIV_OA_WEB_OUTPUT_DIR
适用于 .NET Framework MSBuild 版本 17.9.8+b34f75857
MSBUILD : error MSB1001: 未知开关。
完整命令行:“"C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe" Daiv_OA.Web\Daiv_OA.Web.csproj -o /gitlab-runner/output/Daiv_oa/893”
响应文件追加的开关:
“”来自“C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.rsp”
开关:-o
若要显示开关的语法,请键入“MSBuild -help”
继续折腾下一个坑:MsBuild的正确命令。
黑夜里不停折腾的代码行者。