Jenkins SVN WebDeploy远程服务器
开发环境:win10+vs2107
服务器:winserver2012r2
注:应先设置服务器(步骤:10.11.12.13),再设置vs发布文件(步骤:8.9),最后配置Jenkins(步骤:其他)
1.本地安装Jenkins
2.安装插件,MSBuild Plugin,Subversion Plug-in,没有装Nuget Plugin,因为直接使用了Nuget.exe。
3.全局工具配置中配置MSBuild ,Name随意,Path to MSBuild写的C:\Program Files (x86)\MSBuild\14.0\Bin。
4.系统设置中还配置了全局属性-环境变量,键:path,值:C:\Windows\Microsoft.NET\Framework\v4.0.30319。未验证有没有必要。
5.新建Item ,源码管理选择Subversion,设置svn的url/user/pwd等信息。
6.构建中添加 Execute Windows batch command,写入nuget执行命令
注:此处的nuget.exe直接放置在项目根目录下了
7.构建中添加Build a Visual Studio project or solution using MSBuild,
MSBuild Version选择之前全局工具中添加的MSBuild名字
MSBuild Build File选择需要build的.csproj或是.sln文件
Command Line Arguments写入/p:DeployOnBuild=true;PublishProfile=JenkinsProfile /p:Configuration=Release /p:AllowUntrustedCertificate=True
暂时没发现/p:AspnetMergePath="C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.1 Tools" 这句有用,所以去掉了
注意:PublishProfile为vs中发布时的配置文件名,后面再讲。
AllowUntrustedCertificate必须写这里,.pubxml中无法配置此节点。可能与版本有关,未证实。
如果发布本地文件夹 可以这样写,/t:Rebuild /p:Configuration=Release /p:WebProjectOutputDir=C:\Jenkins_Publish1 /p:OutputPath=C:\Jenkins_Publish1\bin
8.vs中创建发布文件,命名为JenkinsProfile ,与前面的PublishProfile=JenkinsProfile对应。
9.在JenkinsProfile.pubxml中添加节点<Password>*****</Password>
10.服务器安装WebDeploy,我装的是WebDeploy_amd64_zh-CN.msi,并且给iis安装管理服务
服务管理器-->仪表盘-->添加角色和功能-->服务器角色,选择管理服务。
11.iis中启用管理服务,默认端口为8172,防火墙会自动打开。实在没有你就手动啊。
12.可以在服务中看到Web Management Service和Web 部署代理服务,就说明设置没有问题了。
13.服务器iis中创建网站JenkinsTest,与vs发布文件中的站点名称一致。
14.返回Jenkins ,点击立即构建。没意外的话就ok了,有意外。。。。看控制台。
posted on 2017-11-21 12:33 Alternatives 阅读(645) 评论(0) 编辑 收藏 举报