草庐IT

windows - 如果没有桌面 session ,devenv.com 将无法启动

coder 2024-06-06 原文

我正在为 Windows 10 应用程序设置 Jenkins 作业。 我需要使用 devenv.com 可执行文件编译解决方案中的四个项目之一,因为它是一个扩展名为 .vdproj 的项目(安装项目)。 其他项目使用 MSBuild 成功构建,没有任何问题。

当我以 root 身份登录到 Jenkins 目标节点时,Jenkins 作业成功结束,但是当我从 Jenkins 运行作业并且我没有登录时失败。

需要您的帮助或变通方法来解决问题。

PS:我们使用 ant 作为任务运行器,我们有一个启动构建过程的特定任务。

编辑 26/01/2017

我想向您提供其他信息,例如错误消息和我之前跳过的一个步骤。

错误消息提供了指向 Microsoft Page 的链接并报告配置问题。

由此解决 StackOverflow帖子,我在下面添加了一个新的 DWORD 注册表项

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0_Config\MSBuild\EnableOutOfProcBuild

问题是用户未登录时无法读取此值吗?

编辑 27/01/2017

我快被这个问题搞疯了。

devenv/? 命令在我本地运行时工作正常,但当我从 Jenkins 运行它时无法正常工作,并出现与以前相同的错误:Microsoft Visual Studio 发现配置问题。要修复它,请以管理员身份重新启动或访问 http://go.microsoft.com/fwlink/?LinkId=659046了解更多信息。

所以 devenv.com 在我未登录时无法执行??

2017 年 1 月 31 日更新#

这是我的 .bat 文件,由 ant build.xml 从目标调用

call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat"

@set MSBUILD="C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe"

%MSBUILD%  "%cd%\src\AutomatedSetupBuild.proj"

pause

AutomatedSetupBuild.proj 是一个 MSBuild 脚本

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">

<Target Name="Build">
  <PropertyGroup>
        <DevEnv>C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.com</DevEnv>
        <SolutionFile>$(MSBuildProjectDirectory)\MySolution.sln</SolutionFile>
        <ProjectFile>MySetupProject\MySetupProject.vdproj</ProjectFile>
        <Configuration>Release</Configuration>
</PropertyGroup>
    
<Exec
      Command="&quot;$(DevEnv)&quot; &quot;$(SolutionFile)&quot; /Rebuild &quot;$(Configuration)&quot; /Project &quot;$(ProjectFile)&quot; /ProjectConfig &quot;$(Configuration)&quot; /Log vs.log /useenv"
      ContinueOnError="false"
     IgnoreExitCode="false"
     WorkingDirectory="$(MSBuildProjectDirectory)" />
 </Target>
</Project>

如您所见,我在运行 devenv.com 之前加载了环境变量,但我收到了同样的错误。

最佳答案

您是使用自由风格的工作还是使用 Jenkinsfile 进行管道项目?无论如何,要使 devenv.com 正常工作,必须设置环境变量。

请转到 Windows 开始菜单并查找类似 Visual Studio XX -> Visual Studio 工具 -> VS20XX 开发人员命令提示的内容。按鼠标右键并选择属性。在那里寻找目标。在我的例子中,该字段包含以下字符串:

%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat""

如果您使用例如一个 Jenkinsfile,更改对 devnenv.com 的调用,它可能看起来像

bat "devenv.com my_solution_file.sln /project my_project /build  \"Release|x64\""

bat "call \"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat\"; devenv.com my_solution_file.sln /project my_project /build  \"Release|x64\""

重要的是,对 VsDevCmd.bat 的调用在同一个 bat 命令中。否则环境变量设置会丢失,并且不会被第二次调用 bat 看到。

关于windows - 如果没有桌面 session ,devenv.com 将无法启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41853739/

有关windows - 如果没有桌面 session ,devenv.com 将无法启动的更多相关文章

  1. ruby - 在 Ruby 程序执行时阻止 Windows 7 PC 进入休眠状态 - 2

    我需要在客户计算机上运行Ruby应用程序。通常需要几天才能完成(复制大备份文件)。问题是如果启用sleep,它会中断应用程序。否则,计算机将持续运行数周,直到我下次访问为止。有什么方法可以防止执行期间休眠并让Windows在执行后休眠吗?欢迎任何疯狂的想法;-) 最佳答案 Here建议使用SetThreadExecutionStateWinAPI函数,使应用程序能够通知系统它正在使用中,从而防止系统在应用程序运行时进入休眠状态或关闭显示。像这样的东西:require'Win32API'ES_AWAYMODE_REQUIRED=0x0

  2. ruby-on-rails - 由于 "wkhtmltopdf",PDFKIT 显然无法正常工作 - 2

    我在从html页面生成PDF时遇到问题。我正在使用PDFkit。在安装它的过程中,我注意到我需要wkhtmltopdf。所以我也安装了它。我做了PDFkit的文档所说的一切......现在我在尝试加载PDF时遇到了这个错误。这里是错误:commandfailed:"/usr/local/bin/wkhtmltopdf""--margin-right""0.75in""--page-size""Letter""--margin-top""0.75in""--margin-bottom""0.75in""--encoding""UTF-8""--margin-left""0.75in""-

  3. ruby - 难道Lua没有和Ruby的method_missing相媲美的东西吗? - 2

    我好像记得Lua有类似Ruby的method_missing的东西。还是我记错了? 最佳答案 表的metatable的__index和__newindex可以用于与Ruby的method_missing相同的效果。 关于ruby-难道Lua没有和Ruby的method_missing相媲美的东西吗?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/7732154/

  4. ruby-on-rails - 如果为空或不验证数值,则使属性默认为 0 - 2

    我希望我的UserPrice模型的属性在它们为空或不验证数值时默认为0。这些属性是tax_rate、shipping_cost和price。classCreateUserPrices8,:scale=>2t.decimal:tax_rate,:precision=>8,:scale=>2t.decimal:shipping_cost,:precision=>8,:scale=>2endendend起初,我将所有3列的:default=>0放在表格中,但我不想要这样,因为它已经填充了字段,我想使用占位符。这是我的UserPrice模型:classUserPrice回答before_val

  5. ruby-on-rails - 无法使用 Rails 3.2 创建插件? - 2

    我对最新版本的Rails有疑问。我创建了一个新应用程序(railsnewMyProject),但我没有脚本/生成,只有脚本/rails,当我输入ruby./script/railsgeneratepluginmy_plugin"Couldnotfindgeneratorplugin.".你知道如何生成插件模板吗?没有这个命令可以创建插件吗?PS:我正在使用Rails3.2.1和ruby​​1.8.7[universal-darwin11.0] 最佳答案 随着Rails3.2.0的发布,插件生成器已经被移除。查看变更日志here.现在

  6. ruby - 无法运行 Rails 2.x 应用程序 - 2

    我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby​​:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r

  7. ruby-on-rails - rails 目前在重启后没有安装 - 2

    我有一个奇怪的问题:我在rvm上安装了ruby​​onrails。一切正常,我可以创建项目。但是在我输入“railsnew”时重新启动后,我有“程序'rails'当前未安装。”。SystemUbuntu12.04ruby-v"1.9.3p194"gemlistactionmailer(3.2.5)actionpack(3.2.5)activemodel(3.2.5)activerecord(3.2.5)activeresource(3.2.5)activesupport(3.2.5)arel(3.0.2)builder(3.0.0)bundler(1.1.4)coffee-rails(

  8. ruby-on-rails - 无法在centos上安装therubyracer(V8和GCC出错) - 2

    我正在尝试在我的centos服务器上安装therubyracer,但遇到了麻烦。$geminstalltherubyracerBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingtherubyracer:ERROR:Failedtobuildgemnativeextension./usr/local/rvm/rubies/ruby-1.9.3-p125/bin/rubyextconf.rbcheckingformain()in-lpthread...yescheckingforv8.h...no***e

  9. ruby - 无法让 RSpec 工作—— 'require' : cannot load such file - 2

    我花了三天的时间用头撞墙,试图弄清楚为什么简单的“rake”不能通过我的规范文件。如果您遇到这种情况:任何文件夹路径中都不要有空格!。严重地。事实上,从现在开始,您命名的任何内容都没有空格。这是我的控制台输出:(在/Users/*****/Desktop/LearningRuby/learn_ruby)$rake/Users/*******/Desktop/LearningRuby/learn_ruby/00_hello/hello_spec.rb:116:in`require':cannotloadsuchfile--hello(LoadError) 最佳

  10. ruby - 在没有 sass 引擎的情况下使用 sass 颜色函数 - 2

    我想在一个没有Sass引擎的类中使用Sass颜色函数。我已经在项目中使用了sassgem,所以我认为搭载会像以下一样简单:classRectangleincludeSass::Script::FunctionsdefcolorSass::Script::Color.new([0x82,0x39,0x06])enddefrender#hamlengineexecutedwithcontextofself#sothatwithintemlateicouldcall#%stop{offset:'0%',stop:{color:lighten(color)}}endend更新:参见上面的#re

随机推荐