Jenkins .net windows

一、安装
1、JDK 1.7以上
安装完成后,添加环境变量

JAVA_HOME:C:\Program Files (x86)\Java\jdk1.7.0_21
Path:%JAVA_HOME%\bin;
通过cmd: javac 验证是否安装成功

2、jenkins安装
http://jenkins-ci.org/ 下载安装包
http://localhost:8080 启动配制

powershell

服务器白名单
PS C:\Users\53738> winrm set winrm/config/client '@{TrustedHosts="*"}'

所有的环境服务器需要安装PowerShell,同时开启远程访问

PS C:\Users\53738> winrm quickconfig

3、配制
构建:
Erp\Erp.UI\Erp.UI.Web\Erp.UI.Web.csproj
/t:Rebuild /p:Configuration=Release;VisualStudioVersion=14.0;WebProjectOutputDir=E:\Jenkins_Publish;OutputPath=E:\Jenkins_Publish\bin 
/t:ResolveReferences;Compile /t:_CopyWebApplication /p:Configuration=Release /p:WebProjectOutputDir=C:\Jenkins_Publish /p:OutputPath=C:\Jenkins_Publish\bin  

  

     /t:Rebuild /p:Configuration=Release;PublishProfile=Jenkins-DEV;DeployOnBuild=true;VisualStudioVersion=11.0  


  PublishProfile指定创建的Profile名称(没有扩展名)

       DeployOnBuild=true 表示启用编译并发布

       VisualStudioVersion=11.0 表示VS2012

  


MsBuild 不是可用的命令:
1、追加Path环境变量:C:\Windows\Microsoft.NET\Framework\v4.0.30319
2、Jenkins 重起

    http://localhost:8080/restart

 

构建:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe 'E:\workspace\test.e.womaiapp.com\Erp.UI\Erp.UI.Web\Erp.UI.Web.csproj' /t:Rebuild /p:Configuration=Release /p:WebProjectOutputDir=E:\Erp\Web /p:OutputPath=E:\Erp\Web\bin /p:VisualStudioVersion=14.0 /p:Platform=x64

$pw = convertto-securestring -AsPlainText -Force -String P118-J06-2250l.%
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist "Domain\administrator",$pw
$session = new-pssession -computername bj25-118 -credential $cred

cp E:\Web\Web.config Z:\Web2\Web.config

  

 

posted on 2017-06-30 09:55  Hudan  阅读(277)  评论(0编辑  收藏  举报

导航