我需要设置一个Jenkins构建服务器,该服务器可以在不使用Visual Studio的情况下构建ASP.NET项目? [英] What do I need to setup a Jenkins build server that can build ASP.NET projects without Visual Studio?

查看:106
本文介绍了我需要设置一个Jenkins构建服务器,该服务器可以在不使用Visual Studio的情况下构建ASP.NET项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Jenkins(在Windows Server 2012上)设置构建服务器,该服务器将负责ASP.NET MVC/Web API项目的构建(通过配置转换)和打包(zip文件),然后将其移至指定位置(C:/已发布).

I'm trying to setup a build server using Jenkins (on Windows Server 2012) that will be responsible for building (with config transform) and packaging (zip file) ASP.NET MVC/Web API projects, then moving them to designated location (C:/Published).

基本上,我需要通过命令行使用Visual Studio Web Publish for File System,而不必安装Visual Studio.可以通过Jenkins将压缩过程推迟到命令行.

Basically, I need the Visual Studio Web Publish for File System via command line without having to install Visual Studio. The zipping process can be deferred to the command line via Jenkins.

从搜索开始,以下步骤是我到目前为止已完成的操作:

From searching, the following steps is what I've done so far:

  1. 已安装的詹金斯
  2. 已安装Jenkins MSBuild插件
  3. 将"C:\ Program Files(x86)\ MSBuild \ Microsoft \ VisualStudio \ v11.0 \ WebApplications \ Microsoft.WebApplication.targets"复制到我的构建服务器
  4. 已安装 Windows 8 SDK
  5. 创建了从回购中提取源代码的Jenkins职位
  6. 已将命令行参数添加到MSBuild任务中....
  1. Installed Jenkins
  2. Installed Jenkins MSBuild plugin
  3. Copied 'C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets' to my build server
  4. Installed Windows 8 SDK
  5. Created Jenkins job that pulls source code from repo
  6. Added command line arguments to MSBuild task....

第6步让我很沮丧.我在网上尝试了许多建议,但无法弄清楚如何获得Visual Studio的publish命令的全部效果.

Step 6 is what's stumping me. I've tried numerous suggestions online, but can't figure out how to get the full effect of Visual Studio's publish command.

一个建议是使用发布配置文件属性作为参数:

One suggestion was to use a publish profile properties as parameters:

/p:WebPublishMethod=FileSystem
/p:LastUsedBuildConfiguration=Release
/p:LastUsedPlatform=AnyCPU
/p:ExcludeApp_Data=False
/p:publishUrl=C:\Published\
/p:DeleteExistingFiles=True

但这不会将任何文件移到c:\Published\.

But that dosen't move any files over to c:\Published\.

推荐答案

我需要将C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web中的文件从我的开发箱复制到构建服务器上的相同位置,然后这些属性才能正常工作.

I needed to copy the files in C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web from my dev box to the same location on the build server, then the properties worked fine.

除了我上面概述的步骤之外,以下是我必须执行的其他步骤:

In addition to the steps I outlined above, below are the extra steps I had to do to get this working:

  1. 将Jenkins Windows服务更改为以管理员身份登录
  2. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web中的文件从我的开发机复制到构建服务器上的相同位置
  3. 通过在Powershell中运行[Environment]::SetEnvironmentVariable("EnableNuGetPackageRestore", "true.", "Machine")启用了NuGet软件包还原
  1. Changed Jenkins Windows service to logon as Administrator
  2. Copy the files in C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web from my dev machine to the same location on the build server
  3. Enabled NuGet package restore by running [Environment]::SetEnvironmentVariable("EnableNuGetPackageRestore", "true.", "Machine") in Powershell

这篇关于我需要设置一个Jenkins构建服务器,该服务器可以在不使用Visual Studio的情况下构建ASP.NET项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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