本文介绍了xcopy/s/y"$(SolutionDir)packages \ Apache.Ignite.1.6.0 \ Libs \ *.*" "$(TargetDir)Libs";在詹金斯建造时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好, 从jenkins构建Visual Project项目时,出现以下错误,我已经设置了msbuild插件并在jenkins中设置了路径.

Hello All, while building Visual project project from jenkins am getting below error i have set msbuild plugin and set path in jenkins.

C:\ Program Files(x86)\ MSBuild \ 14.0 \ bin \ Microsoft.Common.CurrentVersion.targets(4714,5):错误MSB3073:命令"[C:\ Users \ Administrator.jenkins \ workspace \ DrawingsFabric \\ DrawingsFabricApi \ DrawingsFabricApi.csproj]C:\ Program Files(x86)\ MSBuild \ 14.0 \ bin \ Microsoft.Common.CurrentVersion.targets(4714,5):错误MSB3073:如果不存在"C:\ Users \ Administrator.jenkins \ workspace \ DrawingsFabric \ DrawingsFabricApi \ bin \ x64 \ Debug \ Libs"md" C:\ Users \ Administrator.jenkins \ workspace \ DrawingsFabric \ DrawingsFabricApi \ bin \ x64 \ Debug \ Libs"[C:\ Users \ Administrator.jenkins \ workspace \ DrawingsFabric \ DrawingsFabricApi \ DrawingsFabricApi .csproj]C:\ Program Files(x86)\ MSBuild \ 14.0 \ bin \ Microsoft.Common.CurrentVersion.targets(4714,5):错误MSB3073:xcopy/s/y"未定义 packages \ Apache.Ignite .2.2.0 \ Libs *.*" C:\ Users \ Administrator.jenkins \ workspace \ DrawingsFabric \ DrawingsFabricApi \ bin \ x64 \ Debug \ Libs",代码4退出.[C:\ Users \ Administrator.jenkins \工作区\ DrawingsFabric \ DrawingsFabricApi \ DrawingsFabricApi.csproj]完成的建筑项目"C:\ Users \ Administrator.jenkins \ workspace \ DrawingsFabric \ DrawingsFabricApi \ DrawingsFabricApi.csproj"(默认目标)-失败.

C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4714,5): error MSB3073: The command " [C:\Users\Administrator.jenkins\workspace\DrawingsFabric\DrawingsFabricApi\DrawingsFabricApi.csproj]C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4714,5): error MSB3073: if not exist "C:\Users\Administrator.jenkins\workspace\DrawingsFabric\DrawingsFabricApi\bin\x64\Debug\Libs" md "C:\Users\Administrator.jenkins\workspace\DrawingsFabric\DrawingsFabricApi\bin\x64\Debug\Libs" [C:\Users\Administrator.jenkins\workspace\DrawingsFabric\DrawingsFabricApi\DrawingsFabricApi.csproj]C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4714,5): error MSB3073: xcopy /s /y "Undefinedpackages\Apache.Ignite.2.2.0\Libs*.*" "C:\Users\Administrator.jenkins\workspace\DrawingsFabric\DrawingsFabricApi\bin\x64\Debug\Libs"" exited with code 4. [C:\Users\Administrator.jenkins\workspace\DrawingsFabric\DrawingsFabricApi\DrawingsFabricApi.csproj]Done Building Project "C:\Users\Administrator.jenkins\workspace\DrawingsFabric\DrawingsFabricApi\DrawingsFabricApi.csproj" (default targets) -- FAILED.

构建失败.

"C:\ Users \ Administrator.jenkins \ workspace \ DrawingsFabric \ DrawingsFabricApi \ DrawingsFabricApi.csproj"(默认目标)(1)->(ResolveAssemblyReferences目标)->

"C:\Users\Administrator.jenkins\workspace\DrawingsFabric\DrawingsFabricApi\DrawingsFabricApi.csproj" (default target) (1) ->(ResolveAssemblyReferences target) ->

推荐答案

根据错误日志:

您可以找到$(SolutionDir)未定义.

那是因为您可以在jenkins中构建一个项目(NOT解决方案).在这种情况下,MSBuild独立运行每个项目而不是解决方案,因此MSBuild无法找到$(SolutionDir)的定义.在Visual Studio中工作正常,但在构建服务器上却无法正常工作.

That because you may build the a single project (NOT Solution) in jenkins. In this case, MSBuild running each project independently not the Solution, so MSBuild could not find the define for $(SolutionDir). It worked fine in Visual Studio, but not on the build server.

要解决此问题,可以使用 $(ProjectDir)..\ 代替 $(SolutionDir)

To resolve this issue, you can use $(ProjectDir)..\ instead of $(SolutionDir)

因此命令行应为:

if not exist "$(TargetDir)Libs" md "$(TargetDir)Libs" 
xcopy /s /y "$(ProjectDir)..\packages\Apache.Ignite.2.2.0\Libs\*.*" "$(TargetDir)Libs"

但是,我发现错误日志中的命令行与标题中的命令行不同,因此您可能需要仔细检查命令行.

But, I found the command line in the error log is not same as in the title, so you may need to double check the command line.

希望这会有所帮助.

这篇关于xcopy/s/y"$(SolutionDir)packages \ Apache.Ignite.1.6.0 \ Libs \ *.*" "$(TargetDir)Libs";在詹金斯建造时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-18 20:44