Jenkins builds. NET automatic compilation test and publishing environment

Source: Internet
Author: User

This address: http://blog.csdn.net/wangjia184/article/details/18365553

Operating system windows, ensuring that the. NET framework that is required is installed

Download the Windows installation package from http://jenkins-ci.org/.

After installation, Access http://localhost:8080.

Jenkins = Manager Jenkins = Manage Plugins

In the Available tab, select MSBuild Plugin

Then click Install

After installation, switch to jenkins = Manager Jenkins + Configure System

Find the MSBuild section and fill in the path to MSBuild

such as C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSbuild.exe

Then click New Joband enter the task name

Then configure source code control, such as SVN

And then to the build section,

Msbuilder version is a previously configured "version 4.0"

MSBuild Build file is the name of the project or project file

Then there is the command-line argument for MSBuild.

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

/property:configuration=release represents the release version of the compilation,

/property:targetframeworkversion=v4.5 indicates that the target of the compilation is. NET 4.5

Once saved, click on the left Build now to start testing the compilation.

If an error occurs during compilation, you need to check the Console Output.

A common error condition is that visual Studio is not installed on the compiled machine and may cause MSB4019 errors during compilation. For example

[Plain]View PlainCopyprint?
    1. Error msb4019:the imported Project "C:\Program Files (x86) \msbuild\microsoft\visualstudio\v11.0\webapplications\ Microsoft.WebApplication.targets "was not found. Confirm the path in the <Import> declaration is correct, and that the file exists on disk.

In this case, you can copy the C:\Program Files (x86) \msbuild folder on the development machine to the compiler.

If successful, 0 Error (s)is displayed, and the unit test can be started after the compilation is successful, if there is nunit.

deployment, you can complete the batch process by first installing the Post build task plug-in, just as it was before the MSBuild plugin was installed

Then in the job's configuration, add the Post build task

In the log text, you can use regular expressions to detect 0 error (s) appearing, such as \b0\s+ (Errors)

Directly calling a batch file on disk in script

add 1. How to publish a VS2010 Web site

If you are publishing a Web site, you can specify the csproj file that you want to publish the site directly, such as

Use the following parameters

[Plain]View PlainCopy print?
    1. /t:resolvereferences; Compile/t:_copywebapplication/p:configuration=release/p:webprojectoutputdir=c:\jenkins_publish/p:outputpath=c : \jenkins_publish\bin

Where Webprojectoutputdir is the publishing path of the Web site; OutputPath is the DLL path for the compiled output

add 2. How to publish a VS2012 Web site

Create a new Release configuration item in VS2012 first

Configure the publishing method, such as "File system" to publish, it should be noted that the target location is the path on the compilation server

After saving, these *.pubxml files can be found in the properties/publishprofiles of the project

[HTML]View PlainCopyprint?
  1. <? XML version= "1.0" encoding="Utf-8"?>
  2. <Project toolsversion= "4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
  3. <propertygroup>
  4. <webpublishmethod>filesystem</webpublishmethod>
  5. <lastusedbuildconfiguration>release</lastusedbuildconfiguration>
  6. <lastusedplatform>any CPU</lastusedplatform>
  7. <siteurltolaunchafterpublish />
  8. <launchsiteafterpublish>true</launchsiteafterpublish>
  9. <excludeapp_data>false</excludeapp_data>
  10. <publishurl>c:\jenkins_publish\dev_metadata</publishurl>
  11. <deleteexistingfiles>true</deleteexistingfiles>
  12. </PropertyGroup>
  13. </Project>

You can modify the configuration directly here. Final commit to source code control

The final configuration parameters can be

[Plain]View PlainCopy print?
    1. /t:rebuild/p:configuration=release; Publishprofile=jenkins-dev;deployonbuild=true; visualstudioversion=11.0


publishprofile Specifies the profile name created (no extension)

deployonbuild=true means to enable compiling and publishing

visualstudioversion=11.0 says VS2012

This address: http://blog.csdn.net/wangjia184/article/details/18365553

Jenkins builds. NET automatic compilation test and publishing environment

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.