Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 859
Omar Avatar asked Jun 02 '13 18:06

Omar


People also ask

Which plugin can be used to build a .NET project?

For that, select Manage Jenkins and Click on Manage Plugins. Select the Team Foundation Server Plug-in and VS Team services Continuous Deployment Plugin. Also, we need MS Build Plugin the same as the below screen. From the Source code management tab, will set the source team Foundation Version Control (TFVC).


1 Answers

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
like image 136
Omar Avatar answered Oct 11 '22 20:10

Omar