Use Jenkins to configure the. NET MVC5 Web site to automatically build the entire process record

Source: Internet
Author: User

Continuous integration is a simple repetition of labor, people to operate time and effort, the use of automated building tools to complete the best. One effect that can eventually be achieved is that SVN commits the code, and the server side compiles and publishes it automatically.

Version used: Windows Server R2, and uses its own IIS server.

1. The. NET Framework 4.5 and. NET Framework 4.5 SDK (: are installed on the machine. If you have installed vs on your machine and are able to compile. NET projects, you can skip this step.

2. Download Jenkins to the server and install it.


You can see the interface like this:

3. Click System Management on the left, select plug-in management, install a new plugin called MSBuild Plugin

For example, click Install directly after the tick.

4. Restart Jenkins when the installation is complete, then click System Management on the left to enter the system settings.

5. Locate the following MSBuild node and click New MSBuild, then fill in the name and the path to MSBuild, my configuration is as follows:

6. Find the Subversion node in System administration (note: I am using the SVN Code management tool, if you use other, configure another node), select the version that is currently in use.

At this point, the most basic environment is configured, but at this time Jenkins anyone can come in to change the configuration, their own Baidu, the authentication enabled bar, I believe that as a senior siege lion you, this is a cinch.

When the environment is good, let's add a new project. Let ' s go

1. Click on the page above to create a new task, choose to build a free-style software project, and fill in the good name.

2. Tell Jenkins your SVN account so it can get your current SVN program. Repository, fill in the SVN address of the project you want to build automatically, in the credentials, you need to click Add, fill in your username and password (the items not described in this article will remain the default).

3. Tick poll SCM in the build trigger, and fill in the timeline with * * * * *, indicating that every minute it goes to the SVN server to see if there is no latest version.

4. Under Build Click Add Build step and select Build a Visual Studio project or solution using MSBuild, in command line arguments this entry, fill in the code below

/M trunk/xxx.sln/t:rebuild/p:configuration=release/p:deployonbuild=true; publishprofile=xxx/p:targetframeworkversion=v4.5

/m After you write the sln file you want to compile,/P: The following is a parameter, configuration=release means the release method of compiling, publishprofile=xxx refers to the name of your published file, TargetFrameworkVersion represents your target. NET Framework version, I use 4.5, so just write 4.5 on the line.

My configuration is as follows (online someone said to write the/m parameter to msbuild Build file There is also OK, I tried not to succeed):

In the process, but also encountered a lot of problems, but sometimes it is really confused to solve, I would like to tell you about the problems I encountered:

1. The MSBuild folder on the development machine requires a copy to the server. Microsoft ASP. NET also needs to copy to the server.

2. The. NET Framework SDK needs to be installed on the server, which version of the SDK you need to compile which version of the project

Find the corresponding SDK download from the following link:


Win8.1 corresponds to the. NET Framework V4.5.1

Win8 Correspondence V4.5

2. Compile the MVC project waste a lot of effort, the process of many detours, and finally I found that the server is still a few SDK (I do not understand where these SDKs to download)

I put the development machine on the C:\Program Files (x86) \microsoft SDKs\Windows copied to the server, and to the corresponding registry entries back to the server, the final compilation or error, said to be unable to find aspnet_merge this thing , looking for a long time, found this reference article , and then put C:\Program Files (x86) \msbuild\microsoft\visualstudio\v12.0\web\ Transform folder one of the Microsoft.Web.Publishing.AspNetCompileMerge files in the following <PropertyGroup> The following new code is added below (note: I use the 4.5 framework, so is v8.0a this folder, 4.5.1 should be v8.1a this folder below)

< targetframeworksdktoolsdirectory > C:\Program Files (x86) \microsoft Sdks\windows\v8.0a\bin\netfx 4.0 tools\</  Targetframeworksdktoolsdirectory>

Before and after the contents of the following, we go to find aspnetmergename to distinguish is almost, the server only Notepad, so can not provide line number.

 <PropertyGroup>    <Getaspnetmergepathdependson>getframeworkpaths; </Getaspnetmergepathdependson>  </PropertyGroup>  <TargetName= "Getaspnetmergepath"DependsOnTargets= "$ (getaspnetmergepathdependson)"Condition= "' $ (getaspnetmergepath) '! = ' false '">    <PropertyGroup>      <targetframeworksdktoolsdirectory>C:\Program Files (x86) \microsoft Sdks\windows\v8.0a\bin\netfx 4.0 Tools\</targetframeworksdktoolsdirectory>      <Aspnetmergename>Aspnet_merge.exe</Aspnetmergename>      <AspnetmergepathCondition= "Exists (' $ (targetframeworksdktoolsdirectory) $ (aspnetmergename) ')">$ (targetframeworksdktoolsdirectory)</Aspnetmergepath>    </PropertyGroup>    <ErrorCondition= "' $ (aspnetmergepath) ' = = ' Or! Exists ($ (Aspnetmergepath)) "Text= "Can ' t find the valid Aspnetmergepath" />  </Target>

3. If the failure is due to the absence of a system's assembly (for example: SYSTEM.WEB.MVC), then you must check the properties of this assembly in the local project to copy to local whether the item is true, not true, to true.

4. In fact, there are a lot of errors, are slowly resolved, if you do not mind, you can install a vs on the server for the Web, it is not big, install package around 600M, can save you a lot of things.

5. In the process I encountered a very painful problem, has been prompted I can not find system.web.http this DLL, but I am sure I have this DLL, and is copied to the local =true, but the dead and alive is compiled, but the hint I do not have this DLL, less namespace, Until now, I did not understand, and finally I installed the VS Express as if there is no, if any Daniel know why, please tell me, thank you very much.

It's not too early, for compiling through the excitement I should calm down to go to bed.

Use Jenkins to configure the. NET MVC5 Web site to automatically build the entire process record

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.