FYI ; )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!-- | |
This file is used by the publish/package process of your Web project. You can customize the behavior of this process | |
by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121. | |
--> | |
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<PropertyGroup> | |
<WebPublishMethod>MSDeploy</WebPublishMethod> | |
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration> | |
<LastUsedPlatform>Any CPU</LastUsedPlatform> | |
<SiteUrlToLaunchAfterPublish /> | |
<ExcludeApp_Data>False</ExcludeApp_Data> | |
<MSDeployServiceURL>10.10.10.10</MSDeployServiceURL> | |
<DeployIisAppPath>Default Web Site/Website_01</DeployIisAppPath> | |
<UserName>deploy_user</UserName> | |
<Password>******</Password> | |
<!--<_SavePWD>True</_SavePWD>--> | |
<RemoteSitePhysicalPath /> | |
<SkipExtraFilesOnServer>True</SkipExtraFilesOnServer> | |
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod> | |
<EnableMSDeployBackup>False</EnableMSDeployBackup> | |
<IncludeSetACLProviderOnDestination>False</IncludeSetACLProviderOnDestination> | |
<PublishDatabaseSettings> | |
<Objects xmlns="" /> | |
</PublishDatabaseSettings> | |
<AfterAddIisSettingAndFileContentsToSourceManifest>Empty</AfterAddIisSettingAndFileContentsToSourceManifest> | |
<ExcludeGeneratedDebugSymbol>False</ExcludeGeneratedDebugSymbol> | |
<!--<ExcludeApp_Data>True</ExcludeApp_Data>--> | |
</PropertyGroup> | |
<!--Add Custom Skip Rules--> | |
<Target Name="SkipUpdateRules"> | |
<ItemGroup> | |
<MsDeploySkipRules Include="SkipWebConfig"> | |
<SkipAction></SkipAction> | |
<ObjectName>filePath</ObjectName> | |
<AbsolutePath>Web\.config$</AbsolutePath> | |
<Apply>Source</Apply> | |
<XPath></XPath> | |
</MsDeploySkipRules> | |
<MsDeploySkipRules Include="SkipWebConfig"> | |
<SkipAction></SkipAction> | |
<ObjectName>filePath</ObjectName> | |
<AbsolutePath>Web\.config$</AbsolutePath> | |
<Apply>Destination</Apply> | |
<XPath></XPath> | |
</MsDeploySkipRules> | |
<MsDeploySkipRules Include="SkipDeleteAppData"> | |
<SkipAction></SkipAction> | |
<ObjectName>filePath</ObjectName> | |
<AbsolutePath>$(_Escaped_PackageTempDir)\\App_Data\\.*</AbsolutePath> | |
<XPath> | |
</XPath> | |
</MsDeploySkipRules> | |
<MsDeploySkipRules Include="SkipDeleteAppData"> | |
<SkipAction></SkipAction> | |
<ObjectName>dirPath</ObjectName> | |
<AbsolutePath>$(_Escaped_PackageTempDir)\\App_Data\\.*</AbsolutePath> | |
<XPath> | |
</XPath> | |
</MsDeploySkipRules> | |
</ItemGroup> | |
</Target> | |
<!--EmptyRules--> | |
<Target Name="Empty"> | |
<Message Text="Empty Rules" /> | |
</Target> | |
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
参数列表: | |
+---------------------------------------------------+----------+---------------------------------------------------------+ | |
| 参数名 | 参数类型 | 说明 | | |
+---------------------------------------------------+----------+---------------------------------------------------------+ | |
| MSDeployServiceURL | String | 发布目标服务器地址 | | |
| DeployIisAppPath | String | 发布目标服务器站点地址,支持子站点(WebSite/SubWebSite)| | |
| SkipExtraFilesOnServer | Boolean | 值为False时会删除服务端不在发布清单中的文件 | | |
| UserName | String | WebDeploy 用户名 | | |
| Password | String | WebDeploy 密码 | | |
| ExcludeGeneratedDebugSymbol | String | 值为False时将发布.pdb文件 | | |
| AfterAddIisSettingAndFileContentsToSourceManifest | String | 指定自定义发布清单,不受SkipExtraFilesOnServer影响 | | |
+---------------------------------------------------+----------+---------------------------------------------------------+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |
| MSBuild Build File | src\project.csproj | | |
| Command Line Arguments | /p:Configuration=Release /p:DeployOnBuild=true /p:PublishProfile="x:\xxx\deploy-example.pubxml" /p:VisualStudioVersion=11.0 /p:AllowUntrustedCertificate=true /p:solutionDir=%WORKSPACE% /m /p:DeployIisAppPath=website.com | | |
+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
参数列表: | |
+--------------------------------------------------+-------------------------------------+ | |
| 参数名 | 说明 | | |
+--------------------------------------------------+-------------------------------------+ | |
| /p:Configuration=Release | 编译配置(Debug|Release) | | |
| /p:DeployOnBuild=true | 构建后发布 | | |
| /p:PublishProfile="x:\xxx\deploy-example.pubxml" | 发布配置文件 | | |
| /p:VisualStudioVersion=11.0 | VS版本(可选) | | |
| /p:AllowUntrustedCertificate=true | 允许不信任的证书 | | |
| /p:solutionDir=%WORKSPACE% | 解决方案目录 | | |
| /p:DeployIisAppPath=website.com | 发布目标服务器IIS站点名称 | | |
| /m | 启用多核编译 | | |
+--------------------------------------------------+-------------------------------------+ |
- 安装并配置 Jenkins
- 将
0.deploy-example.pubxml.xml
重命名为自己想要的名称.pubxml
- Jenkins 添加任务
Build a Visual Studio project or solution using MSBuild
参考配置2.msbuild.jenkins.txt
3.msbuildjenkins.txt
- 可选,如果.NET项目中使用了NuGet,可能还需要配置Jenkins服务所使用用户下配置默认Nuget源,例如添加官方源:
NuGet sources Add -Name www.nuget.org -Source https://www.nuget.org/api/v2/
- 完毕