之前写过一篇文章是在CentOS上构建.net自动化编译环境, 今天这篇是针对于Windows平台的环境。 Jenkins是一个开源软件项目,旨在提供一个开放易用的软件平台,使软件的持续集成变成可能。Jenkins是基于Java开发的一种持续集成工具,用于监控持续重复的工作,
Jenkins是由Sun的前员工开发的,它的根基是Java,但也可以用在非Java的项目里,比如PHP、Ruby on Rails、.NET。持续集成相关的工具有很多。它提供了Web界面,用户可以在界面
上配置Job,每个Job都包含一系列的构建步骤。Jenkins可以完成开头那个场景中所提到的所有验证工作,它还能更进一步做自动化部署或者一键式部署。
我们开始吧, 环境 Windows Server 2012 1. Install Jenkins
http://ftp-nyc.osuosl.org/pub/jenkins/windows/jenkins-1.629.zip 2. Install MsBuild, Git Plugin for Jenkins GIT client plugin
Shared library plugin for other Git> GIT plugin
This plugin integrates GIT with Jenkins. MSBuild Plugin
This plugin makes it possible to build a Visual Studio project (.proj) and solution files (.sln). SCM API Plugin
This plugin provides a new enhanced API for interacting with SCM systems. Credentials Plugin
This plugin allows you to store credentials in Jenkins.
插件可以在这儿找到 https://wiki.jenkins-ci.org/display/JENKINS/Plugins 3. Install Git
从官网下载安装 http://www.git-scm.com/downloads 4. Install .net Framework 4.5.2
官网下载安装 http://www.microsoft.com/en-us/download/details.aspx?id=42642 5. Install 微软Build Tools 2013
官网下载安装 http://www.microsoft.com/en-us/download/details.aspx?id=40760 6. 假设本地已安装VS2013, 复制本地 C:\Program Files (x86)\MSBuild\Microsoft 下所有文件到服务器相同位置上
笔者是看到是这些文件
打包放置到服务器上面对应路径。 7. Install Web Deploy v3.0
官网下载安装 http://www.iis.net/downloads/microsoft/web-deploy 8. Install Artifact Deployer Plugin
This artifact allows you to choose which directories you will like to deploy to the target destination
https://wiki.jenkins-ci.org/display/JENKINS/ArtifactDeployer+Plugin Jenkins的系统配置 Git配置
MsBuild配置
邮件
其它问题 1. 编译时转换Web.config文件
例如, 我们需要在Release模式下,替换Web错误显示机制,数据库连接字符串, 日志文件输出级别或目录等配置都可以。
If you add the following xml to the bottom of the .csproj file for your web application, you'll ensure that the config transformation occurs before every build:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
Edit: In response to your comment, you should be able to use Web.config as the source parameter in the TransformXml task (see step #2). If you only want to perform the config transform in the build script, follow these instructions:
1) Import WebApplication.targets in your build script like so:
2. Microsoft.Build.Tasks.v4.0编译问题Build Failure issue:
could not be loaded from the assembly "C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Build.Tasks.v4.0.dll". Could not load file or assembly 'file:///C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Build.Tasks.v4.0.dll
Ideally you should be doing the following:
1) Open your NuGet.targets file: C:\Builds\1\xxxx\FTP Processor (New)\src.nuget\nuget.targets