{"id":3754,"date":"2009-03-16T22:52:04","date_gmt":"2009-03-16T22:52:04","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/webdev\/2009\/03\/16\/web-packaging-installing-web-packages-using-command-line\/"},"modified":"2009-03-16T22:52:04","modified_gmt":"2009-03-16T22:52:04","slug":"web-packaging-installing-web-packages-using-command-line","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/web-packaging-installing-web-packages-using-command-line\/","title":{"rendered":"Web Packaging: Installing Web Packages using Command Line"},"content":{"rendered":"<p>Today I want to advance our discussions around Web Deployment in Visual Studio 10\u2026&#160; To catch up on the previous discussions in this series check out:<\/p>\n<li><a href=\"http:\/\/vishaljoshi.blogspot.com\/2009\/02\/web-deployment-with-vs-2010-and-iis.html\" target=\"_blank\" rel=\"noopener\">Web Deployment with VS 2010 and IIS<\/a> <\/li>\n<li><a href=\"http:\/\/vishaljoshi.blogspot.com\/2009\/02\/web-packaging-creating-web-package.html\" target=\"_blank\" rel=\"noopener\">Web Packaging: Creating a Web Package using VS 2010<\/a> <\/li>\n<li><a href=\"http:\/\/vishaljoshi.blogspot.com\/2009\/02\/web-packaging-creating-web-packages.html\" target=\"_blank\" rel=\"noopener\">Web Packaging: Creating web packages using MSBuild<\/a> <\/li>\n<li>\n<p><a href=\"http:\/\/vishaljoshi.blogspot.com\/2009\/03\/how-does-web-deployment-with-vs-10.html\" target=\"_blank\" rel=\"noopener\">How does Web Deployment with VS 10 &amp; MSDeploy Work?<\/a>&#160;<\/p>\n<p>In this post I will focus on installing the MSDeploy based Web Packages to IIS.&#160; You can actually install\/deploy web packages using multiple different avenues listed below:<\/p>\n<ol>\n<li>Using IIS Manager UI <\/li>\n<li>Using command file created by Visual Studio 10 <\/li>\n<li>Using command line using MSDeploy.exe <\/li>\n<li>Using Power Shell support provided by MS Deploy <\/li>\n<li>Using managed APIs provided by MS Deploy <\/li>\n<\/ol>\n<p>VS 10 will create Web Packages for you based on your settings in the \u201cPublish\u201d tab of the Web Application Projects (WAPs) property pages.&#160; In the Publish tab you also specify the location where you want the package to be created.&#160; In the same \u201cPublish\u201d tab, you also get an option to specify your destination information (i.e. IIS Application Name, Physical Location on the server)\u2026<\/p>\n<p>Check out the section of \u201cPublish\u201d tab below which will give you an idea of the same:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2009\/03\/image5B715D.png\" \/><\/p>\n<p>&#160;<\/p>\n<p>After setting all the above information when you right click on your project and click Package \u2013&gt; Create Package then the web package is created at the location specified in \u201cPackage Location\u201d setting. To know more read <a href=\"http:\/\/vishaljoshi.blogspot.com\/2009\/02\/web-packaging-creating-web-package.html\" target=\"_blank\" rel=\"noopener\">Web Package Creation post<\/a>.<\/p>\n<p>When you create a package VS creates three files of interest in folder specified by \u201cPackage Location\u201d in \u201cPublish\u201d tab; those three files are:<\/p>\n<\/li>\n<li>\n<p><u>Web Package<\/u> : The package&#160; itself is produced, which can be either a ZIP file or a folder called \u201cAchieve\u201d.&#160; The choice between .zip vs folder is determined based on your settings in \u201cPublish\u201d tab<\/p>\n<\/li>\n<li>\n<p><u>Destination Manifest<\/u>:&#160; This is the file which will allow you to change the destination information at the time of install eg. connection string, IIS Application name etc<\/p>\n<\/li>\n<li>\n<p><u>Deploy Command File<\/u>:&#160; VS creates a .cmd file encapsulating MSDeploy command for you so that you don\u2019t even have to type the MSDeploy command while installing the package..<\/p>\n<p>So on your dev box below is what happens:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image_2.png\"><img decoding=\"async\" title=\"VS10 package creation\" alt=\"VS10 package creation\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2009\/03\/image_thumb.png\" width=\"292\" height=\"371\" \/><\/a> <\/p>\n<p>Now when you want to install the package created all you have to do is to take these three files to the destination server and run the command file.&#160; Typically you can hand out these three files to your server administrator and he\/she can run the command on the server (as developers will typically not have access to the servers directly).<\/p>\n<p>In the earlier post we talked about how to <a href=\"http:\/\/vishaljoshi.blogspot.com\/2009\/02\/web-packaging-creating-web-package.html\" target=\"_blank\" rel=\"noopener\">create a web package for BlogEngine.Web<\/a> solution in staging configuration, let us look at how the solution explorer looks like after the package is created:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image_6.png\"><img decoding=\"async\" title=\"Solution Explorer after package is created\" alt=\"Solution Explorer after package is created\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2009\/03\/image_thumb_2.png\" width=\"310\" height=\"338\" \/><\/a> <\/p>\n<p>Notice the package file, destination manifest and the command file in the above image.<\/p>\n<p>If you remember our <a href=\"http:\/\/lh5.ggpht.com\/_E8t3edIzcC8\/SY-d7OO1x4I\/AAAAAAAAArM\/A2zN21_95Uo\/image%5B71%5D.png\" target=\"_blank\" rel=\"noopener\">Package settings<\/a> while creating the web package; in \u201cPublish\u201d tab we provided Destination IIS Application Name as&#160; \u201cDefault Web Site\/VS10-Blog\u201d&#160; and Destination IIS Physical Path as \u201cC:TR8VS10-Blog\u201d.&#160; If we install the package that is where we would expect the install to go (unless I overwrite it using destination manifest and the deploy command file)<\/p>\n<p>I am now going to emulate a Server Admin and try to install the web package which was handed to me by the developer by going to Start\u2014&gt;All Programs \u2013&gt; IIS&#160; 7.0 Extensions \u2013&gt; MSDeploy Command Console (as Admin)<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image_4.png\"><img decoding=\"async\" title=\"MSDeploy Command Console\" alt=\"MSDeploy Command Console\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2009\/03\/image_thumb_1.png\" width=\"289\" height=\"394\" \/><\/a> <\/p>\n<p>Note: In IIS 5.1 or IIS 6 you can just start regular command prompt and navigate to MSDeploy install location which is typically %Program Files%IISMicrosoft Web Deploy<\/p>\n<p>Also note that server admins can very easily automate these process by writing simple batch files.<\/p>\n<p>In MSdeploy command console I will now try to call \u201cBlogEngine.Web.Deploy.cmd\u201d.&#160; I have ensured that the destination manifest, command file and the package are all in the same folder; see the image below:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image_8.png\"><img decoding=\"async\" title=\"image\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2009\/03\/image_thumb_3.png\" width=\"479\" height=\"221\" \/><\/a> <\/p>\n<p>In MSDeploy Command prompt I can run the VS 10 generated .cmd files in two different modes:<\/p>\n<ol>\n<li>\/T \u2013 This is the Trial run switch.&#160; It will allow your server admin to verify whether your package is not going to do something really bad :-)\u2026 But in essence this mode invokes msdeploy in \u2013what if mode which allows you to see what all package will do on the server. <\/li>\n<li>\/Y \u2013 This switch will actually install the package and get it set up on the server. <\/li>\n<\/ol>\n<p>Below is how my command propmpt looks after running the BlogEngine.Web.Deploy.cmd file with \/T switch<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image_18.png\"><img decoding=\"async\" title=\"msdeploy command in \/T -whatif mode\" alt=\"msdeploy command in \/T -whatif mode\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2009\/03\/image_thumb_8.png\" width=\"691\" height=\"212\" \/><\/a> <\/p>\n<p>Notice the \/T switch on the cmd file which in result calls msdeploy in \u2013what if mode\u2026&#160; I truncated the overall out put to show you the final set of information which is \u201cChange Count\u201d\u2026<\/p>\n<p>Now when you run the command file with \/Y switch the installation will succeed with the above change count\u2026 Now, let us go and inspect IIS Manager to make sure VS-10 blog application is correctly created with below traits:<\/p>\n<ul>\n<li>Application name is VS10-Blog <\/li>\n<li>Physical directory for the application is \u201cC:TR8VS10-Blog <\/li>\n<li>Classic .NET App Pool setting that we configured in <strong><a href=\"http:\/\/vishaljoshi.blogspot.com\/2009\/02\/web-packaging-creating-web-package.html\" target=\"_blank\" rel=\"noopener\">Step 2: Configure IIS Settings in IIS Manager<\/a><\/strong> in the previous blog post is also correctly configured. <\/li>\n<\/ul>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image_20.png\"><img decoding=\"async\" title=\"deployed blogengine.web\" alt=\"deployed blogengine.web\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2009\/03\/image_thumb_9.png\" width=\"571\" height=\"354\" \/><\/a> <\/p>\n<p>If you run this application now, it should be fully functional as well\u2026<\/p>\n<p>If you are trying to automate your deployment process then I recommend using the instructions in <a href=\"http:\/\/vishaljoshi.blogspot.com\/2009\/02\/web-packaging-creating-web-packages.html\" target=\"_blank\" rel=\"noopener\">MSBuild based package creation post<\/a> to create your web packages in an automated fashion and eventually use the instructions in this post to go ahead and deploy the web package.<\/p>\n<p>I hope that the above few posts will help you get your web apps up and running with using the VS 10 Web Packaging support\u2026.<\/p>\n<p>Vishal R. Joshi | Program Manager | Visual Studio Web Developer<\/p>\n<div style=\"padding-bottom: 0px;margin: 0px;padding-left: 0px;padding-right: 0px;float: none;padding-top: 0px\" id=\"scid:0767317B-992E-4b12-91E0-4F059A8CECA8:4a799562-6489-495b-8281-54e5160f52f7\" class=\"wlWriterEditableSmartContent\">Technorati Tags: <a href=\"http:\/\/technorati.com\/tags\/Web+Deployment\" rel=\"tag\">Web Deployment<\/a>,<a href=\"http:\/\/technorati.com\/tags\/Web+Packaging\" rel=\"tag\">Web Packaging<\/a>,<a href=\"http:\/\/technorati.com\/tags\/MSDeploy\" rel=\"tag\">MSDeploy<\/a>,<a href=\"http:\/\/technorati.com\/tags\/MSBuild\" rel=\"tag\">MSBuild<\/a>,<a href=\"http:\/\/technorati.com\/tags\/VS10\" rel=\"tag\">VS10<\/a>,<a href=\"http:\/\/technorati.com\/tags\/Visual+Studio\" rel=\"tag\">Visual Studio<\/a>,<a href=\"http:\/\/technorati.com\/tags\/Vishal+R.+Joshi\" rel=\"tag\">Vishal R. Joshi<\/a>,<a href=\"http:\/\/technorati.com\/tags\/Visual+Studio+2010\" rel=\"tag\">Visual Studio 2010<\/a><\/div>\n<\/p>\n<\/li>\n","protected":false},"excerpt":{"rendered":"<p>Today I want to advance our discussions around Web Deployment in Visual Studio 10\u2026&#160; To catch up on the previous discussions in this series check out: Web Deployment with VS 2010 and IIS Web Packaging: Creating a Web Package using VS 2010 Web Packaging: Creating web packages using MSBuild How does Web Deployment with VS [&hellip;]<\/p>\n","protected":false},"author":404,"featured_media":58792,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[197],"tags":[31,7301,7306,7299,7321,3862,7336,7263,7284,7323,7319,7324,7264,7268,7329],"class_list":["post-3754","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aspnet","tag-asp-net","tag-beta","tag-build","tag-iis","tag-install","tag-installation","tag-msdeploy","tag-pm","tag-vishal-r-joshi","tag-visual-studio-2010","tag-visual-web-developer","tag-vs10","tag-wap","tag-web","tag-web-deployment"],"acf":[],"blog_post_summary":"<p>Today I want to advance our discussions around Web Deployment in Visual Studio 10\u2026&#160; To catch up on the previous discussions in this series check out: Web Deployment with VS 2010 and IIS Web Packaging: Creating a Web Package using VS 2010 Web Packaging: Creating web packages using MSBuild How does Web Deployment with VS [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/3754","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/404"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=3754"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/3754\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/58792"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=3754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=3754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=3754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}