MSBuild-Jenkins-Nuget集成 [英] MSBuild - Jenkins - Nuget integration

查看:152
本文介绍了MSBuild-Jenkins-Nuget集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Jenkins和MSBuild,我们正在经历一些奇怪的行为. 在手动输入命令行以构建build.xml项目时:

We are experiencing some weird behavior using Jenkins and MSBuild. When manually typing into a command line to build a build.xml project:

msbuild build.xml /T:Package /P:PublishProfile=Test /P:Platform="AnyCPU" 
                  /P:VisualStudioVersion=12.0

构建过程完全按预期进行(构建,包装等)
但是,如果我正在使用詹金斯(Jenkins)精确地做到这一点-即-打开命令行并运行此确切命令,则会收到一条错误消息:

The build process works exactly as expected (build, packaging, etc.)
However, if I am using Jenkins to do exactly this - that is - open a command line and run this exact command, I get an error saying:

The command ""..\.nuget\NuGet.exe" install 
"C:\Jenkins\jobs\.....\workspace\MYPROJECT\packages.config" 
-source ""  -NonInteractive -RequireConsent -solutionDir "..\ "" exited with code 1

即使我使用内置的jenkins插件运行命令(无论我使用哪种parma组合),它也都不会使用.
我知道以下两种声音听起来像是一种解决方案,但是它们不起作用:

Even if I am using the built-in jenkins plugin to run the command (regardless which parma combination I use), it still doesn't.
I know two of the following sounds like a solution, but they don't work:

  1. 权限!-我的服务器始终以管理员身份运行.
  2. 从VS启用NuGet上的软件包还原-已经做到了!
  1. Permissions! - My server always runs as admin.
  2. Enabling package restoring on NuGet from VS - Already did!

任何想法都很棒!

推荐答案

答案是这里,解决了很长时间,这要感谢

Here is the answer, it took a long time to solve, and thanks to @adarshr I came to realize the problem is because of the difference between the Jenkins runner's user (i.e the jenkins Service) and my user. To resolve this issue I've made Jenkins running as the same user and all good!

逐步:

  1. 转到控制面板->系统和安全->管理工具
  2. 单击服务"快捷方式.
  3. 右键单击Jenkins服务,然后选择属性".
  4. 导航到登录"标签.
  5. 单击以该用户身份运行,然后填写您的凭据.
  6. 重新启动詹金斯.

像魅力一样工作!

这篇关于MSBuild-Jenkins-Nuget集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆