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?
- 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?
- /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?
- <? XML version= "1.0" encoding="Utf-8"?>
- <Project toolsversion= "4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
- <propertygroup>
- <webpublishmethod>filesystem</webpublishmethod>
- <lastusedbuildconfiguration>release</lastusedbuildconfiguration>
- <lastusedplatform>any CPU</lastusedplatform>
- <siteurltolaunchafterpublish />
- <launchsiteafterpublish>true</launchsiteafterpublish>
- <excludeapp_data>false</excludeapp_data>
- <publishurl>c:\jenkins_publish\dev_metadata</publishurl>
- <deleteexistingfiles>true</deleteexistingfiles>
- </PropertyGroup>
- </Project>
You can modify the configuration directly here. Final commit to source code control
The final configuration parameters can be
[Plain]View PlainCopy print?
- /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