{"id":1177,"date":"2019-03-27T13:42:57","date_gmt":"2019-03-27T05:42:57","guid":{"rendered":"https:\/\/blog.jsjs.org\/?p=1177"},"modified":"2019-03-27T13:42:57","modified_gmt":"2019-03-27T05:42:57","slug":"net%e6%8c%81%e7%bb%ad%e9%9b%86%e6%88%90-jenkinsgitwebdeploy","status":"publish","type":"post","link":"https:\/\/blog.jsjs.org\/?p=1177","title":{"rendered":".Net\u6301\u7eed\u96c6\u6210 \u2014\u2014 Jenkins+Git+WebDeploy"},"content":{"rendered":"<p>\u7531\u4e8e\u67d0\u4e9b\u5386\u53f2\u95ee\u9898\uff0c\u6700\u8fd1\u7ec8\u4e8e\u53ef\u4ee5\u4ecejava\u4e2d\u89e3\u8131\u51fa\u6765\uff0c\u7ee7\u7eed\u8015\u8018.Net\u4e86\uff0c\u7b2c\u4e00\u6b65\u5c31\u662f\u628a\u4e4b\u524d\u7684java\u9879\u76ee\u7ffb\u6210.net\u3002\u4e4b\u524d\u5df2\u7ecf\u5b9e\u73b0\u8fc7\u4e00\u6b21\uff0c\u7ffb\u8d77\u6765\u8fd8\u662f\u6bd4\u8f83\u5feb\u7684(\u5f53\u7136\u57fa\u7840\u67b6\u6784\/\u5b9e\u4f53\u6a21\u578b\u5df2\u7ecf\u91cd\u65b0\u601d\u8003\u5e76\u6539\u8fdb)\uff0c\u800c\u4e14\u6d4b\u8bd5\u4e5f\u5728\u8ddf\u8fdb\uff0c\u6240\u4ee5\u4e00\u5929\u8981\u53d1\u65e0\u6570\u6b21\u7248\u672c\uff0c\u8fd8\u8981\u8003\u8651\u5f00\u53d1\u73af\u5883\u3001\u6d4b\u8bd5\u73af\u5883\uff0c\u603b\u53d1\u5e03\u51fa\u9519\uff0c\u751a\u662f\u5fc3\u7d2f\u3002\u4e8e\u662f\u4e0b\u51b3\u5fc3\u6539\u5584\u6548\u7387\uff0c\u4ee5\u4e0a\u4e3a\u80cc\u666f\u3002<\/p>\n<p>\u770b\u4e86\u5f88\u591a\u6587\u7ae0\uff0c\u6700\u7ec8\u51b3\u5b9a\u4f7f\u7528Jenkins\u3002\u4ee5\u4e0b\u662f\u6211\u6574\u4e2a\u914d\u7f6e\u7684\u8bb0\u5f55\uff1a<\/p>\n<h1>1. \u73af\u5883<\/h1>\n<p>Platform: .Net4.5<\/p>\n<p>IDE: Visual Studio 2015 &amp; MsBuild<\/p>\n<p>\u5305\u7ba1\u7406:NuGet<\/p>\n<p>\u7248\u672c\u63a7\u5236:TFS-git<\/p>\n<p>\u670d\u52a1\u5668: windows 2012 R2(IIS8)<\/p>\n<p>\u5176\u4ed6: webdeploy<\/p>\n<p>\u53c2\u8003\u6587\u7ae0\uff1ahttp:\/\/blog.couchbase.com\/2016\/january\/continuous-deployment-with-jenkins-and-.net<\/p>\n<p>&nbsp;<\/p>\n<h1>2. \u8f6f\u4ef6\u4e0b\u8f7d\u4e0e\u5b89\u88c5<\/h1>\n<h3>\u3000Jenkins\uff1a<\/h3>\n<p>\u5728<strong><span lang=\"EN-US\"><a href=\"https:\/\/jenkins.io\/index.html\">https:\/\/jenkins.io\/index.html<\/a>\u00a0<\/span><\/strong><span lang=\"EN-US\">\u4e0b\u8f7dwindows\u7248\u672c\uff0c\u6309\u7167\u6b65\u9aa4\u5b89\u88c5\uff0c\u5b89\u88c5\u597d\u4e4b\u540e\uff0cjenkins\u7ba1\u7406\u5730\u5740\u9ed8\u8ba4\u4e3a http:\/\/localhost:8080<\/span><\/p>\n<h3><strong><span lang=\"EN-US\">\u3000IIS:<\/span><\/strong><\/h3>\n<p><strong><span lang=\"EN-US\">\u3000\u3000<\/span><\/strong><span lang=\"EN-US\">\u9664\u4e86\u5b89\u88c5IIS\u5fc5\u8981\u7684\u529f\u80fd\uff0c\u6ce8\u610f\u52fe\u9009 web\u670d\u52a1\u5668-&gt;\u7ba1\u7406\u5de5\u5177 \u4e2d \u9664&#8221;IIS6 \u7ba1\u7406\u517c\u5bb9\u6027&#8221;\u7684\u529f\u80fd<\/span><\/p>\n<h3><strong><span lang=\"EN-US\">\u3000WebDeploy\uff1a<\/span><\/strong><\/h3>\n<p><strong><span lang=\"EN-US\">\u3000\u3000<\/span><\/strong><span lang=\"EN-US\">\u4e0b\u8f7d\u5730\u5740<\/span><strong><span lang=\"EN-US\">\u00a0<\/span><\/strong><a href=\"http:\/\/www.iis.net\/downloads\/microsoft\/web-deploy\">http:\/\/www.iis.net\/downloads\/microsoft\/web-deploy<\/a>\u00a0\uff0c\u6ce8\u610f\u4e00\u5b9a\u8981\u52fe\u9009\u00a0IIS Deployment Handler \uff0c\u5426\u5219\u4f7f\u7528PublishProfile\u65f6\u4f1a\u62a5404\u9519\u8bef<\/p>\n<p>\u5b89\u88c5\u597d\u4e4b\u540e\uff0c\u4f60\u7684IIS\u670d\u52a1\u5668\u4f1a\u591a\u51fa\u6765 Management Service,\u70b9\u8fdb\u53bb\uff0c\u4fee\u6539\u914d\u7f6e<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/images2015.cnblogs.com\/blog\/475388\/201604\/475388-20160413181727082-537664739.jpg\" alt=\"\" width=\"971\" height=\"745\" \/><\/p>\n<h3>\u3000Git\u5ba2\u6237\u7aef\uff1a<\/h3>\n<p>\u8fd9\u4e2a\u5c31\u4e0d\u591a\u8bf4\u4e86\uff0c\u5f88\u591a\u5730\u65b9\u90fd\u6709<\/p>\n<h3>\u3000MsBuild\uff1a<\/h3>\n<p>\u5730\u5740\u00a0<em><a href=\"https:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=48159\">https:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=48159<\/a>\u00a0\u3002<\/em>\u8fd9\u91cc\u5b89\u88c5\u7684\u53ea\u662f\u7cbe\u7b80\u7248\u7684MsBuild\uff0c\u5982\u679c\u6709VS\u7684\u5168\u91cf\u7248\u90a3\u662f\u6700\u597d\u4e0d\u8fc7\uff0c\u540e\u9762build\u7684\u65f6\u5019\u5c31\u77e5\u9053\u6709\u591a\u5751\u4e86==\uff01<\/p>\n<p>\u5982\u679c\u53ea\u88c5\u8fd9\u4e2aMsBuild\uff0c\u8981\u5c06\u4f60\u5f00\u53d1\u673a\u5668\u4e0a\u7684 MsBuild\\Microsoft\\VisualStudio \u6587\u4ef6\u5939\u62f7\u8d1d\u5230\u670d\u52a1\u5668\u4e0a\u76f8\u5e94\u7684\u6587\u4ef6\u5939\uff0c\u5426\u5219\u7f16\u8bd1MVC\u9879\u76ee\u65f6\u4f1a\u62a5\u9519\uff08Target\u627e\u4e0d\u5230\uff09<\/p>\n<h3>\u3000Microsoft SDK:<\/h3>\n<p>\u540c\u6837\u662fbuild\u65f6\u5019\u7528\u5230\uff08error : Can&#8217;t find the valid AspnetMergePath\uff09\uff0c\u4f60\u53ef\u4ee5\u5b89\u88c5\u6216\u8005\u76f4\u63a5\u62f7\u8d1d\uff0c\u628a\u6587\u4ef6\u5939C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v8.1A \u62f7\u8d1d\u5230\u76ee\u6807\u670d\u52a1\u5668\u76f8\u5e94\u76ee\u5f55<\/p>\n<h1>3. \u914d\u7f6e<\/h1>\n<h2>\u3000Jenkins\u914d\u7f6e\uff1a<\/h2>\n<h3>\u3000\u30001&gt;\u00a0\u5b89\u88c5Git plugin, Multi SCMs \u548c MsBuild plugin \uff08\u5728\u53c2\u8003\u6587\u7ae0\u4e2d\u6709\u8be6\u7ec6\u8bf4\u660e\uff09<\/h3>\n<p>\u6b65\u9aa4\uff1aa) \u6253\u5f00jenkins http:\/\/localhost:8080<\/p>\n<p>b) \u627e\u5230Manage Jenkins-&gt;Manage Plugins-&gt;\u53ef\u9009\u63d2\u4ef6<\/p>\n<p>c) \u641c\u7d22\u63d2\u4ef6\u5e76\u5b89\u88c5<\/p>\n<p>\u914d\u7f6e\uff1a\u5982\u4e0b\u56fe<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/images2015.cnblogs.com\/blog\/475388\/201604\/475388-20160413174621098-328877858.jpg\" alt=\"\" width=\"1295\" height=\"574\" \/><\/p>\n<p>\u6ce8\u610f\u914d\u7f6e Git plugin \u4e2d\u7684 Global Config user.name\u548cuser.email<\/p>\n<h2>\u30002&gt; \u9879\u76ee\u914d\u7f6e<\/h2>\n<p>\u6211\u8fd9\u91cc\u5c31\u76f4\u63a5\u8d34\u51fa\u6765\u4e86\uff0c\u4e5f\u6bd4\u8f83\u7b80\u5355<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/images2015.cnblogs.com\/blog\/475388\/201604\/475388-20160413175940754-1135248521.jpg\" alt=\"\" width=\"1388\" height=\"842\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/images2015.cnblogs.com\/blog\/475388\/201604\/475388-20160413180210895-494577497.jpg\" alt=\"\" width=\"1464\" height=\"797\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/images2015.cnblogs.com\/blog\/475388\/201604\/475388-20160413180609082-175804625.jpg\" alt=\"\" width=\"1397\" height=\"791\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u8bf4\u660e\uff1aMsBuild\u914d\u7f6e\u4e2d\u6709\u989d\u5916\u9009\u9879\uff0c\u8fd9\u91cc\u8d34\u51fa\u6765\uff0c\/p:DeployOnBuild=true;PublishProfile=backend \/p:Configuration=Release \/p:AspnetMergePath=&#8221;C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v8.1A\\bin\\NETFX 4.5.1 Tools&#8221;<\/p>\n<p>PublishProfile\u5c31\u662fVS\u4e2d\u6307\u5b9a\u7684\u53d1\u5e03\u914d\u7f6e\u540d\u79f0\uff0c\u540e\u9762\u7684AspnetMergePath\u7528\u4e8e\u89e3\u51b3\u4e0a\u9762MsTools\u7684\u62a5\u9519<\/p>\n<p>\u6ce8\u610f\uff1a1. \u4f60\u914d\u7f6e\u7684\u8def\u5f84\u6700\u597d\u4e0d\u8981\u8fc7\u6df1\uff0c\u5fae\u8f6f\u9650\u5236\u4e86\u8def\u5f84\u6700\u5927\u957f\u5ea6266\uff0c\u5230\u65f6\u5019\u4f1a\u60b2\u5267\u7684==\uff01<\/p>\n<p>2. \u5982\u679cGit\u8ba4\u8bc1\u51ed\u636e\u586b\u5199\u5728URL\u4e2d\uff0c\u7528\u6237\u540d\/\u5bc6\u7801\u4e0d\u53ef\u4ee5\u5305\u542b\u7279\u6b8a\u5b57\u7b26\uff0c\u5426\u5219\u4f1a\u88abencode\u5bfc\u81f4\u62c9\u53d6\u5931\u8d25\u3002\u5efa\u8bae\u4e0d\u8981\u914d\u7f6e\u5728URL\u4e2d\uff0c\u672c\u6587\u8fd9\u6837\u914d\u7f6e\u662f\u56e0\u4e3aGIT\u670d\u52a1\u5668\u4e3aTFS\uff0c\u4e0d\u652f\u6301Credential<\/p>\n<h2>\u30003&gt; VS PublishProfile\u914d\u7f6e<\/h2>\n<p>VS\u9879\u76ee\u4e2d\u65b0\u5efa\u914d\u7f6e\u6587\u4ef6\uff0c\u9009\u62e9Web Deploy\uff0c\u7136\u540e\u6307\u5b9aServer\/Site name\/User name\/Password\/Destation URL \uff0c\u914d\u597d\u4e4b\u540e\u70b9\u51fb\u4e00\u4e0bValidate Connection\uff0c\u901a\u8fc7\u5c31\u6210\u529f\u5566\uff01<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/images2015.cnblogs.com\/blog\/475388\/201604\/475388-20160420094107523-1891911332.jpg\" alt=\"\" width=\"823\" height=\"604\" \/><\/p>\n<p>\u914d\u7f6e\u4fdd\u5b58\u4e4b\u540e\uff0c\u6253\u5f00\u76f8\u5e94\u7684pubxml\u6587\u4ef6\uff0c\u52a0\u4e0a\u4ee5\u4e0b\u8fd9\u4e24\u884c\uff1a<\/p>\n<p>&lt;Password&gt;your password&lt;\/Password&gt;<br \/>\n&lt;AllowUntrustedCertificate&gt;True&lt;\/AllowUntrustedCertificate&gt;<\/p>\n<p>&nbsp;<\/p>\n<h1>4 Try it!<\/h1>\n<p>\u597d\u4e86\uff0c\u5230\u8fd9\u91cc\u4e00\u4e2a.Net MVC\u9879\u76ee\u81ea\u52a8\u6784\u5efa\u5c31\u57fa\u672c\u5f04\u597d\u4e86\uff0c\u8fdb\u5165jenkins\uff0c\u627e\u5230\u521a\u624d\u914d\u7f6e\u7684\u9879\u76ee\uff0c\u70b9\u51fb \u7acb\u5373\u6784\u5efa\u3002<\/p>\n<p>\u6784\u5efa\u4f1a\u6309\u7167 git\u62c9\u53d6-&gt;nuget \u8fd8\u539f-&gt;build-&gt; deploy-&gt;send email\u8fd9\u4e2a\u987a\u5e8f\u6267\u884c\uff0c\u70b9\u51fbConsole output\u53ef\u4ee5\u770b\u5230\u8be6\u7ec6\u7684\u6267\u884c\u8fc7\u7a0b\uff0c\u5f88\u957f\u6211\u5c31\u4e0d\u8d34\u51fa\u6765\u4e86\u3002\u6709\u65f6\u95f4\u518d\u5199\u4e00\u4e0b windows \u670d\u52a1\u7684\u81ea\u52a8\u6784\u5efa\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u73b0\u5728\u90e8\u7f72\u8fd8\u662f\u5f88\u723d\u7684\uff0c\u4e00\u952e\u5b8c\u6210\uff0cNo Errors!<\/p>\n<p>&nbsp;<\/p>\n<p>https:\/\/www.cnblogs.com\/kickinthehead\/p\/5388201.html<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7531\u4e8e\u67d0\u4e9b\u5386\u53f2\u95ee\u9898\uff0c\u6700\u8fd1\u7ec8\u4e8e\u53ef\u4ee5\u4ecejava\u4e2d\u89e3\u8131\u51fa\u6765\uff0c\u7ee7\u7eed\u8015\u8018.Net\u4e86\uff0c\u7b2c\u4e00\u6b65\u5c31\u662f\u628a\u4e4b\u524d\u7684java\u9879\u76ee\u7ffb\u6210.net\u3002\u4e4b\u524d\u5df2\u7ecf\u5b9e\u73b0\u8fc7\u4e00\u6b21\uff0c\u7ffb\u8d77\u6765\u8fd8\u662f\u6bd4\u8f83\u5feb\u7684(\u5f53\u7136\u57fa\u7840\u67b6\u6784\/\u5b9e\u4f53\u6a21\u578b\u5df2\u7ecf\u91cd\u65b0\u601d\u8003\u5e76\u6539\u8fdb)\uff0c\u800c\u4e14\u6d4b\u8bd5\u4e5f\u5728\u8ddf\u8fdb\uff0c\u6240\u4ee5\u4e00\u5929\u8981\u53d1\u65e0\u6570\u6b21\u7248\u672c\uff0c\u8fd8\u8981\u8003\u8651\u5f00\u53d1\u73af\u5883\u3001\u6d4b\u8bd5\u73af\u5883\uff0c\u603b\u53d1\u5e03\u51fa\u9519\uff0c\u751a\u662f\u5fc3\u7d2f\u3002\u4e8e\u662f\u4e0b\u51b3\u5fc3\u6539\u5584\u6548\u7387\uff0c\u4ee5\u4e0a\u4e3a\u80cc\u666f\u3002 \u770b\u4e86\u5f88\u591a\u6587\u7ae0\uff0c\u6700\u7ec8\u51b3\u5b9a\u4f7f\u7528Jenkins\u3002\u4ee5\u4e0b\u662f\u6211\u6574\u4e2a\u914d\u7f6e\u7684\u8bb0\u5f55\uff1a 1. \u73af\u5883 Platform: .Net4.5 IDE: Visual Studio 2015 &amp; MsBuild \u5305\u7ba1\u7406:NuGet \u7248\u672c\u63a7\u5236:TFS-git \u670d\u52a1\u5668: windows 2012 R2(IIS8) \u5176\u4ed6: webdeploy [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1177","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts\/1177","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1177"}],"version-history":[{"count":0,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts\/1177\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}