JENKINS+MSBUILD+SVN enables fast build. NET Continuous Integration environment (build, edit, deploy to server)

Source: Internet
Author: User
Tags ftp upload file imap mail account

Jenkins is an extensible, continuous integration engine that is easy to install and configure, and easy to use, starting with the. NET Continuous Integration Environment

Jenkins and SVN installation is not covered here.

First, the preparatory work

1, Jenkins System Management-"management plug-in" optional plug-in found MSBuild Plugin, install plug-in MSBuild Plugin, used for automatic editing of. NET Projects

Description: Some features of the configuration process need to install some plug-ins, you can go to the management plug-in to find and install

2. Configure MSBuild (System Management--) Global Tool configuration ( Global Tool Configuration )--"MSBuild Installation"

Parameter filling instructions:

MSBuild name is just a name that can be filled in casually, but it is recommended to fill in a somewhat meaningful name, for example: msbuild_v4.0

Path to MSBuild this is the path where MSBuild is installed, for example: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe

The configuration here will be used in the later build (tab) operation

3. Jenkins location and system administrator email address

System Management--"System Setup Find Jenkins location

4, Email notification configuration (message sender information)

Email notification needs to be configured in two places, one in System Management-"system setup Extended e-mail Notification,

One is the post-build operation in each job project configuration editable Email notification node configuration:

Need to download and install the Email Extension Plugin plugin First

System Management --"System settings find Extended e-mail Notification (this plugin needs to be installed, some of the information in the figure needs to click the Advanced button to display)

System Management--"system settings find the mail notification node configuration (some of the information in the figure needs to click the Advanced button to display):

The above configuration is the 163 message message of the sender of the message, stating:

SMTP server (SMTP servers): Login 163 mailbox for Get (Settings--"pop3/smtp/imap)

User name (username): The account name of the login sender 163 mailbox

Password (password): Login Sender 163 e-mail account password

Default Subject: Build Notification: $PROJECT _name-build # $BUILD _number-$BUILD _status

Default content: Here I use the following custom contents format

<! DOCTYPE html>

<meta charset= "UTF-8" >

<title>${env, var= "Job_name"}-${build_number} times build Log </title>

<body leftmargin= "8" marginwidth= "0" topmargin= "8" marginheight= "4"

offset= "0" >

<table width= "95%" cellpadding= "0" cellspacing= "0"

Style= "FONT-SIZE:13PT; Font-family:tahoma, Arial, Helvetica, Sans-serif ">

<tr>

<td><br/>

<b><font color= "#0B610B" > Build information </font></b>

</tr>

<tr>

<td>

<ul>

<li> Project Name: ${project_name}</li>

<li> build number: ${build_number} times Build </li>

<LI>SVN version: ${svn_revision}</li>

<li> build log: <a href= "${build_url}console" >${BUILD_URL}console</a></li>

<li> build Url: <a href= "${build_url}" >${BUILD_URL}</a></li>

<li> working directory: <a href= "${project_url}ws" >${PROJECT_URL}ws</a></li>

<li> Project Url: <a href= "${project_url}" >${PROJECT_URL}</a></li>

<li> Build Reason: ${cause}</li>

</ul>

</td>

</tr>

<tr>

<td><b><font color= "#0B610B" > Change set </font></b>

</tr>

<tr>

<td>${jelly_script,template= "HTML"}</td>

</tr>

</table>

</body>

Login 163 Email-"Set--" Pop3/smtp/imap

Turn on the service Pop3/smtp/imap set the client authorization code

5, each job project after the construction of the Mail notification configuration (Configuration message recipient information), into the configuration:

Click Advanced Settings in the lower-right corner to enter premium settings:

Note that you need to add triggers, do not add triggers will not send notification messages come out, this is a trigger condition .

The main added triggers are three categories: failure-any,success,unstable (Test failures), which correspond to build failures, build successfully, and trigger email notifications when building instability.

Send to refers to the person sent to, by default sent to developers, that is, the build has modified the action of the person, I generally choose recipient list, is the default list of members added to the mailbox will be sent notification messages.

Description

Recipient List: The mailbox that receives the message (if more than one comma is separated)

Content: A template for sending messages

Second, now start to build job

Click New

Click on the OK button to enter the page,

Here I choose to parameterize the build process, add parameters (a Boolean parameter), name custom: Isaosdeploy, description also custom

Click Source Control (tab)--"Select subversion, here I use SVN as the versioning tool

Add login svn account and Password build trigger (tab) This is the set interval how long to check if the SVN code has changed, if there is a change, then recompile the Build Environment (tab) does not study the role of this configuration, using the default, do not make any modifications to build (tab) This setting automatically compiled mode , and copy the compiled site files to the server IIS site Directory, note that this step is important, if you do not configure this step can only complete the construction of the project, and do not have the builtjenkinsworkplace Projects under the workspace are automatically compiled and automatically deployed to server-side IISto complete this step, you need to install the plugin firstMSBuild Plugin

Description: The example shown here shows the installation of Jenkins and the server of the final published IIS site is the same machine, so it is relatively simple to copy files on the same machine after automatic compilation. If it is on a different machine or the site is distributed to n servers, then you need to upload the copy file by FTP, then you need to install the plug-in ftp publisher plugin or Publish over FTP, the two plug-ins use different ways, This way follow-up re-introduction

Description

Msbuilder Version for previously configured "msbuild_v4.0"

MSBuild Build File is The name of the project file or project file under the Jenkinsworkplace workspace

/t:rebuild means rebuilding every time, not using incremental compilation

/t:resolvereferences; Compile/t:_copywebapplication

/p:configuration=release means compiling release version

/property:targetframeworkversion=v4.0 indicates that the target of the compilation is. NET 4.0

/p:webprojectoutputdir= D:\JenkinsWorkplace\vuedemo represents the output path of the Web site publishing file ( This example is not used )

/p:outputpath= D:\JenkinsWorkplace\vuedemo\bin represents the output path of the Web site publishing DLL ( This example is not used )

/p:deployonbuild=true means to enable compiling and publishing

/p:visualstudioversion=11.0 said it was VS2012.

File Copy command for site

xcopy D:\JenkinsWorkplace\VueDEMO G:\jenkinsweb\vuedemo/s/e/y/exclude:c:\users\vuedemo\desktop\exclude.txt

D:\JenkinsWorkplace\VueDEMO file directory to copy

G:\JenkinsWeb\VueDEMO copy files to this directory

/s copies directories and subdirectories, except for empty.

/e copies directories and subdirectories, including empty.

/y Suppresses the prompt to confirm overwriting an existing target file (overwriting if the file exists).

Exclude:c:\users\vuedemo\desktop\exclude.txt

/EXCLUDE Specifies a list of files that contain strings. If any string matches the absolute path of the file to be copied, the file will not be copied. For example, specifying such as \obj\ or. obj excludes all files under directory obj or files with the. obj extension.

Exclude.txt documents are excluded files or directories, if there are many types of files or directories to exclude, then the user breaks the split, as in this example

Exclude. pdb suffixes for files, and Web. config files, obj folders, and so on

Post-Build Action (tab) This key is to configure email notifications to send the compilation to the developer, as described earlier To this has been the job configuration completed, the following to see the build results because the build record is too long, here I only intercept the key part of the show three, account permissions settings System Management-"global security Configuration
Four, manually installed plug-in as follows

MSBuild Plugin

Build Timeout

Email Extension Plugin

Publish over FTP

FTP Publisher Plugin

V.Jenkins FTP upload file (automatically deployed to Web server IIS)

Here are two ways to introduce:

First: Using the FTP Publisher plugin plugin

The first step: System Management--"system setup find FTP repository hosts, add one, edit well, save

Timeout (ms): Time-out (ms)

Step Two: Open the job project configuration

Add post-build steps and select Publish artifacts to FTP

Second: Use Publish over FTP Plugin plugin

The first step: System Management--"system setup find Publish over FTP, add one, edit well, save

Timeout (ms): Time-out (ms)

Use active Data mode: (unchecked) default option use PASV (passive mode), check using PORT (active mode)

Don ' t make nested dirs: Do not create sub-directories (see Help for yourself)

Step Two: Open the job project configuration

In the project configuration, you can find the configuration of this plug-in from the following two locations.

Build Steps: Send Files over FTP

Post-build actions: Send build artifacts over FTP

Add build step, select Send files over FTP

Exclude files: Excluded file (useful when you are transmitting a directory, using wildcards, e.g.**/*.log, **/*.tmp, vuedemo/obj/**)

Pattern separator: Delimiter ( the delimiter that configures Exclude files and Source files. If you change here, the above content also needs to be changed)

No default excludes: the exclusion rule is forbidden (specific self-view help)

Make empty dirs: This option changes the default behavior of the plug-in. The default behavior is to match whether the file exists, and if so, create a directory store. Selecting this option creates a directory where the file is stored, even if it is an empty directory. (Personal understanding)

Flatten files: Create a file only on FTP, not directory (except remote directory)

Remote directory is a date format: a long-dated folder is created with a date format (you will need to configure the date formats in your rd directory ), as described in the following table:

remote directory /p>

directories created

' qa- approved/' Yyyymmddhhmmss

qa-approved/20101107154555

' builds/' yyyy/mm/dd/' build-${build_number} '

builds/2010/11/07/build-456  (if the build was number 456)

yyyy_mm/' build '-eee-d-hhmmss

2010_11/build-sun-7-154555

yyyy-mm-dd_hh-mm-ss

2010-11-07_15-45-55

Clean remote: Deletes all files from the remote directory before uploading (the lesson of blood, the test is the operation of the team's FTP, and then accidentally deleted their data, harm I do data recovery.) )

ASCII mode: The way the file is transferred, it is generally not selected by default.

Add post-build operation steps, select Send build artifacts over FTP

Configure the same way

JENKINS+MSBUILD+SVN enables fast build. NET Continuous Integration environment (build, edit, deploy to server)

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: info-contact@alibabacloud.com 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.