What do I need to setup a Jenkins build server that can build ASP.NET projects without Visual Studio?

谁都会走 提交于 2019-12-20 09:46:46

问题


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).

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. 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....

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

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


回答1:


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. 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


来源:https://stackoverflow.com/questions/16886134/what-do-i-need-to-setup-a-jenkins-build-server-that-can-build-asp-net-projects-w

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!