<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Sayed Ibrahim Hashimi - MSBuild, Web Deploy (MSDeploy), ASP.NET - Microsoft</title>
    <link>http://sedodream.com/</link>
    <description>MSBuild, C#, Visual Studio and more</description>
    <language>en-us</language>
    <copyright>Sayed Ibrahim Hashimi</copyright>
    <lastBuildDate>Fri, 15 Jun 2012 19:07:30 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>sayed.hashimi@gmail.com</managingEditor>
    <webMaster>sayed.hashimi@gmail.com</webMaster>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=bfa8b339-0bf2-4d9c-995b-beaef0ce39ba</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,bfa8b339-0bf2-4d9c-995b-beaef0ce39ba.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,bfa8b339-0bf2-4d9c-995b-beaef0ce39ba.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=bfa8b339-0bf2-4d9c-995b-beaef0ce39ba</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Last week we rolled out some updates for our Visual Studio 2010 Web Publishing Experience.
This post will give you an overview of the new features which we released. In the
coming weeks there will be more posts getting into more details regarding individual
features. 
</p>
        <p>
You can get these updates in the <a href="http://go.microsoft.com/fwlink/?LinkID=254269&amp;clcid=0x409">Windows
Azure SDK for Visual Studio 2010</a>. When you download that package there you will
also get the latest tools for Azure development.
</p>
        <p>
The new high level features include the following.
</p>
        <ul>
          <li>
Updated Web Publish dialog 
</li>
          <li>
Support to import publish profiles (<em>.publishSettings files</em>) 
</li>
          <li>
Support to configure EF Code First migrations during publish 
</li>
          <li>
Support to create web packages in the publish dialog 
</li>
          <li>
Publish profiles now a part of the project and stored in version control by default 
</li>
          <li>
Publish profiles are now MSBuild files 
</li>
          <li>
Profile specific web.config transforms 
</li>
        </ul>
        <h1>Overview
</h1>
        <p>
When you right click on your Web Application Project (WAP) you will now see the new
publish dialog.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/da1ea8decc68_BC52/image_4.png">
            <img style="background-image: none; display: inline" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/da1ea8decc68_BC52/image_thumb_1.png" width="724" height="564" />
          </a>
        </p>
        <p>
On this tab you can import a .publishSettngs file, which many web hosts provide, and
you can also manage your publish profiles. If you are hosting your site on Windows
Azure Web Sites then you can download the publish profile on the dashboard of the
site using the <em>Download publish profile</em> link. After you import this publish
profile you will be brought to the Connection tab automatically.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/da1ea8decc68_BC52/image_8.png">
            <img style="background-image: none; display: inline" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/da1ea8decc68_BC52/image_thumb_3.png" width="724" height="564" />
          </a>
        </p>
        <p>
On this tab you can see all the server configuration values which are needed for your
client machine to connect to the server. Typically you don’t have to worry about the
details of these values. Next you’ll go to the Settings tab.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/da1ea8decc68_BC52/image_10.png">
            <img style="background-image: none; display: inline" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/da1ea8decc68_BC52/image_thumb_4.png" width="724" height="564" />
          </a>
        </p>
        <p>
On the Settings tab you can set the build configuration which should be used for the
publish process, the default value here is Release. There is also a checkbox to enable
you to delete any files on the server which do not exist in the project.
</p>
        <p>
Below that checkbox you will see a section for databases. The sample project shown
has an <a href="http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application">Entity
Framework</a> Code First model, named ContactsContext, and it uses <a href="http://msdn.microsoft.com/en-us/library/hh770484">Code
First Migrations</a> to manage the database schema. If you have any non-EF Code First
connection strings in web.config then those databases will show up as well but the
support for incrementally publishing the schema for those has not yet been finalized.
We are currently working on that. You can visit <a href="http://sedodream.com/2012/06/07/VSPublishDialogUpdateDatabaseDialogDisabled.aspx">my
previous blog entry</a> for more info on that.
</p>
        <p>
If you imported a .publishSettings file with a connection string then that connection
string would automatically be inserted in the textbox/dropdown for the connection
string. If you did not then you can use the … button to create a connection string
with the Connection String Builder dialog or you can simply type/paste in a connection
string. For the EF Code First contexts you will see the <em>Execute Code Frist Migrations</em> checkbox.
When you check this when your site is published the web.config will be transformed
to enable the Code First migrations to be executed the first time that the context
is accessed. Now you can move to the Preview tab.
</p>
        <p>
When you first come to the Preview tab you will see a Start Preview button. Once you
click this button you will see the file operations which would be performed once you
publish. Since this site has never been published all the file operations are Add,
as you can see in the image below. The other Action values include; Update and Delete.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/da1ea8decc68_BC52/image_14.png">
            <img style="background-image: none; display: inline" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/da1ea8decc68_BC52/image_thumb_6.png" width="724" height="564" />
          </a>
        </p>
        <p>
Once you are ready to publish you can click the Publish button. You can monitor the
progress of the publish process using the Output Window. If your publish profile had
a value for the Destination URL then the site will automatically be opened in the
default browser after the publish has successfully completed.
</p>
        <h1>Publish Profiles
</h1>
        <p>
One of the other changes in the publish experience is that publish profiles are now
stored as a part of your project. They are stored under the folder Properties\PublishProfiles
(<em>for VB projects its My Project\PublishProfiles</em>) and the extension is .pubxml.
You can see this in the image below.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/da1ea8decc68_BC52/image_18.png">
            <img style="background-image: none; display: inline" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/da1ea8decc68_BC52/image_thumb_8.png" width="330" height="475" />
          </a>
        </p>
        <p>
These .pubxml files are MSBuild files and you can modify these files in order to customize
the publish process. If you do not want the publish profile to be checked into version
control you can simply exclude it from the project. The publish dialog will look at
the files in the PublishProfiles folder so you will still be able to publish using
that profile. You can also leverage these publish profiles to simply publishing from
the command line. For example you can use the following syntax to publish from the
command line.
</p>
        <p>
msbuild.exe WebApplication2.csproj /p:DeployOnBuild=true;PublishProfile="pubdemo
- Web Deploy";Password={INSERT-PASSWORD}
</p>
        <p>
 
</p>
        <h1>Resources
</h1>
        <ul>
          <li>
            <a href="http://go.microsoft.com/fwlink/?LinkID=254269&amp;clcid=0x409">Windows Azure
SDK for Visual Studio 2010</a> (<em>this contains the new Web Publish experience</em>) 
</li>
          <li>
Tutorial: <a href="https://www.windowsazure.com/en-us/develop/net/tutorials/web-site-with-sql-database/">Deploying
an ASP.NET Web Application to a Windows Azure Web Site and SQL Database</a></li>
          <li>
            <a href="http://blogs.msdn.com/b/aspnetue/archive/2012/06/12/visual-studio-2012-rc-deployment-documentation-published.aspx">Visual
Studio 2012 RC Deployment Documentation Published</a> (<em>the publish experience
in VS2012 RC is nearly identical to the VS 2010 Web Publish updates</em>) 
</li>
          <li>
            <a href="http://sedodream.com/">Sayed’s blog</a>
          </li>
        </ul>
        <p>
If you have any questions please feel free to directly reach out to me at sayedha(at){MicrosoftDOTCom}.
</p>
        <p>
Sayed Ibrahim Hashimi <a href="https://twitter.com/#!/sayedihashimi">@SayedIHashimi</a></p>
      </body>
      <title>Visual Studio 2010 Web Publish Updates</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,bfa8b339-0bf2-4d9c-995b-beaef0ce39ba.aspx</guid>
      <link>http://sedodream.com/2012/06/15/VisualStudio2010WebPublishUpdates.aspx</link>
      <pubDate>Fri, 15 Jun 2012 19:07:30 GMT</pubDate>
      <description>&lt;p&gt;
Last week we rolled out some updates for our Visual Studio 2010 Web Publishing Experience.
This post will give you an overview of the new features which we released. In the
coming weeks there will be more posts getting into more details regarding individual
features. 
&lt;/p&gt;
&lt;p&gt;
You can get these updates in the &lt;a href="http://go.microsoft.com/fwlink/?LinkID=254269&amp;amp;clcid=0x409"&gt;Windows
Azure SDK for Visual Studio 2010&lt;/a&gt;. When you download that package there you will
also get the latest tools for Azure development.
&lt;/p&gt;
&lt;p&gt;
The new high level features include the following.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Updated Web Publish dialog 
&lt;/li&gt;
&lt;li&gt;
Support to import publish profiles (&lt;em&gt;.publishSettings files&lt;/em&gt;) 
&lt;/li&gt;
&lt;li&gt;
Support to configure EF Code First migrations during publish 
&lt;/li&gt;
&lt;li&gt;
Support to create web packages in the publish dialog 
&lt;/li&gt;
&lt;li&gt;
Publish profiles now a part of the project and stored in version control by default 
&lt;/li&gt;
&lt;li&gt;
Publish profiles are now MSBuild files 
&lt;/li&gt;
&lt;li&gt;
Profile specific web.config transforms 
&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;Overview
&lt;/h1&gt;
&lt;p&gt;
When you right click on your Web Application Project (WAP) you will now see the new
publish dialog.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/da1ea8decc68_BC52/image_4.png"&gt;&lt;img style="background-image: none; display: inline" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/da1ea8decc68_BC52/image_thumb_1.png" width="724" height="564" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
On this tab you can import a .publishSettngs file, which many web hosts provide, and
you can also manage your publish profiles. If you are hosting your site on Windows
Azure Web Sites then you can download the publish profile on the dashboard of the
site using the &lt;em&gt;Download publish profile&lt;/em&gt; link. After you import this publish
profile you will be brought to the Connection tab automatically.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/da1ea8decc68_BC52/image_8.png"&gt;&lt;img style="background-image: none; display: inline" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/da1ea8decc68_BC52/image_thumb_3.png" width="724" height="564" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
On this tab you can see all the server configuration values which are needed for your
client machine to connect to the server. Typically you don’t have to worry about the
details of these values. Next you’ll go to the Settings tab.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/da1ea8decc68_BC52/image_10.png"&gt;&lt;img style="background-image: none; display: inline" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/da1ea8decc68_BC52/image_thumb_4.png" width="724" height="564" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
On the Settings tab you can set the build configuration which should be used for the
publish process, the default value here is Release. There is also a checkbox to enable
you to delete any files on the server which do not exist in the project.
&lt;/p&gt;
&lt;p&gt;
Below that checkbox you will see a section for databases. The sample project shown
has an &lt;a href="http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application"&gt;Entity
Framework&lt;/a&gt; Code First model, named ContactsContext, and it uses &lt;a href="http://msdn.microsoft.com/en-us/library/hh770484"&gt;Code
First Migrations&lt;/a&gt; to manage the database schema. If you have any non-EF Code First
connection strings in web.config then those databases will show up as well but the
support for incrementally publishing the schema for those has not yet been finalized.
We are currently working on that. You can visit &lt;a href="http://sedodream.com/2012/06/07/VSPublishDialogUpdateDatabaseDialogDisabled.aspx"&gt;my
previous blog entry&lt;/a&gt; for more info on that.
&lt;/p&gt;
&lt;p&gt;
If you imported a .publishSettings file with a connection string then that connection
string would automatically be inserted in the textbox/dropdown for the connection
string. If you did not then you can use the … button to create a connection string
with the Connection String Builder dialog or you can simply type/paste in a connection
string. For the EF Code First contexts you will see the &lt;em&gt;Execute Code Frist Migrations&lt;/em&gt; checkbox.
When you check this when your site is published the web.config will be transformed
to enable the Code First migrations to be executed the first time that the context
is accessed. Now you can move to the Preview tab.
&lt;/p&gt;
&lt;p&gt;
When you first come to the Preview tab you will see a Start Preview button. Once you
click this button you will see the file operations which would be performed once you
publish. Since this site has never been published all the file operations are Add,
as you can see in the image below. The other Action values include; Update and Delete.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/da1ea8decc68_BC52/image_14.png"&gt;&lt;img style="background-image: none; display: inline" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/da1ea8decc68_BC52/image_thumb_6.png" width="724" height="564" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Once you are ready to publish you can click the Publish button. You can monitor the
progress of the publish process using the Output Window. If your publish profile had
a value for the Destination URL then the site will automatically be opened in the
default browser after the publish has successfully completed.
&lt;/p&gt;
&lt;h1&gt;Publish Profiles
&lt;/h1&gt;
&lt;p&gt;
One of the other changes in the publish experience is that publish profiles are now
stored as a part of your project. They are stored under the folder Properties\PublishProfiles
(&lt;em&gt;for VB projects its My Project\PublishProfiles&lt;/em&gt;) and the extension is .pubxml.
You can see this in the image below.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/da1ea8decc68_BC52/image_18.png"&gt;&lt;img style="background-image: none; display: inline" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/da1ea8decc68_BC52/image_thumb_8.png" width="330" height="475" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
These .pubxml files are MSBuild files and you can modify these files in order to customize
the publish process. If you do not want the publish profile to be checked into version
control you can simply exclude it from the project. The publish dialog will look at
the files in the PublishProfiles folder so you will still be able to publish using
that profile. You can also leverage these publish profiles to simply publishing from
the command line. For example you can use the following syntax to publish from the
command line.
&lt;/p&gt;
&lt;p&gt;
msbuild.exe WebApplication2.csproj /p:DeployOnBuild=true;PublishProfile=&amp;quot;pubdemo
- Web Deploy&amp;quot;;Password={INSERT-PASSWORD}
&lt;/p&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;h1&gt;Resources
&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://go.microsoft.com/fwlink/?LinkID=254269&amp;amp;clcid=0x409"&gt;Windows Azure
SDK for Visual Studio 2010&lt;/a&gt; (&lt;em&gt;this contains the new Web Publish experience&lt;/em&gt;) 
&lt;/li&gt;
&lt;li&gt;
Tutorial: &lt;a href="https://www.windowsazure.com/en-us/develop/net/tutorials/web-site-with-sql-database/"&gt;Deploying
an ASP.NET Web Application to a Windows Azure Web Site and SQL Database&lt;/a&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://blogs.msdn.com/b/aspnetue/archive/2012/06/12/visual-studio-2012-rc-deployment-documentation-published.aspx"&gt;Visual
Studio 2012 RC Deployment Documentation Published&lt;/a&gt; (&lt;em&gt;the publish experience
in VS2012 RC is nearly identical to the VS 2010 Web Publish updates&lt;/em&gt;) 
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://sedodream.com/"&gt;Sayed’s blog&lt;/a&gt; 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
If you have any questions please feel free to directly reach out to me at sayedha(at){MicrosoftDOTCom}.
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi &lt;a href="https://twitter.com/#!/sayedihashimi"&gt;@SayedIHashimi&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,bfa8b339-0bf2-4d9c-995b-beaef0ce39ba.aspx</comments>
      <category>asp.net</category>
      <category>Microsoft</category>
      <category>MSDeploy</category>
      <category>Visual Studio 2010</category>
      <category>web</category>
      <category>Web Deployment Tool</category>
      <category>Web Publishing Pipeline</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=6021286d-1d57-49d6-af59-53a812c4ceb8</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,6021286d-1d57-49d6-af59-53a812c4ceb8.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,6021286d-1d57-49d6-af59-53a812c4ceb8.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=6021286d-1d57-49d6-af59-53a812c4ceb8</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In Visual Studio 2010 we introduced a database publishing experience in the Package/Publish
SQL (PP/SQL) properties page. This support relies on generating <strong>create scripts</strong> from
the source database and then executing those scripts when you publish your web application.
For more details regarding this feature take a look at <a href="http://msdn.microsoft.com/en-us/library/dd576376">Package/Publish
SQL Tab, Project Properties</a>. One of the negative aspects of the implementation
that we have there is that the DB schema publishing is not incremental, it always
executes create scripts. So in many cases you publish your app for the first time
and things are great, but the next time you try to publish you receive errors because
it tries to create DB objects which already exist.
</p>
        <p>
In our improved publish dialog we have a new database publishing experience which
is incremental, so you don’t run into the same issues when re-deploying your database.
All of the configuration for this is within the publish dialog itself. If you have
a project which already has DB publish settings on the Package/Publish SQL tab (under
any build configuration/platform) then you will see the message shown in the image
below.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/2ad1530b6464_FCBD/SNAGHTML2bb135.png">
            <img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTML2bb135" border="0" alt="SNAGHTML2bb135" src="http://sedodream.com/content/binary/Windows-Live-Writer/2ad1530b6464_FCBD/SNAGHTML2bb135_thumb.png" width="724" height="564" />
          </a>
        </p>
        <p>
The new incremental DB schema publish mechanism is not compatibly with the feature
set on the PP/SQL tab. For each web publish profile you can either use the settings
on the PP/SQL tab or you can opt-in to the new experience on the publish dialog. We
implemented it this way in order to introduce the new feature set and to ensure that
existing publish scenarios are not broken.
</p>
        <p>
FYI there is a related post on <a href="http://sedodream.com/2012/06/07/VSPublishDialogUpdateDatabaseDialogDisabled.aspx">why
the Update database checkbox</a> is disabled in the publish dialog which you may be
interested in.
</p>
        <p>
If you have any questions please feel free to directly reach out to me at sayedha(at){MicrosoftDOTCom}.
</p>
        <p>
Sayed Ibrahim Hashimi <a href="https://twitter.com/#!/sayedihashimi">@SayedIHashimi</a></p>
      </body>
      <title>Database settings in the VS Publish dialog</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,6021286d-1d57-49d6-af59-53a812c4ceb8.aspx</guid>
      <link>http://sedodream.com/2012/06/07/DatabaseSettingsInTheVSPublishDialog.aspx</link>
      <pubDate>Thu, 07 Jun 2012 22:09:13 GMT</pubDate>
      <description>&lt;p&gt;
In Visual Studio 2010 we introduced a database publishing experience in the Package/Publish
SQL (PP/SQL) properties page. This support relies on generating &lt;strong&gt;create scripts&lt;/strong&gt; from
the source database and then executing those scripts when you publish your web application.
For more details regarding this feature take a look at &lt;a href="http://msdn.microsoft.com/en-us/library/dd576376"&gt;Package/Publish
SQL Tab, Project Properties&lt;/a&gt;. One of the negative aspects of the implementation
that we have there is that the DB schema publishing is not incremental, it always
executes create scripts. So in many cases you publish your app for the first time
and things are great, but the next time you try to publish you receive errors because
it tries to create DB objects which already exist.
&lt;/p&gt;
&lt;p&gt;
In our improved publish dialog we have a new database publishing experience which
is incremental, so you don’t run into the same issues when re-deploying your database.
All of the configuration for this is within the publish dialog itself. If you have
a project which already has DB publish settings on the Package/Publish SQL tab (under
any build configuration/platform) then you will see the message shown in the image
below.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/2ad1530b6464_FCBD/SNAGHTML2bb135.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTML2bb135" border="0" alt="SNAGHTML2bb135" src="http://sedodream.com/content/binary/Windows-Live-Writer/2ad1530b6464_FCBD/SNAGHTML2bb135_thumb.png" width="724" height="564" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
The new incremental DB schema publish mechanism is not compatibly with the feature
set on the PP/SQL tab. For each web publish profile you can either use the settings
on the PP/SQL tab or you can opt-in to the new experience on the publish dialog. We
implemented it this way in order to introduce the new feature set and to ensure that
existing publish scenarios are not broken.
&lt;/p&gt;
&lt;p&gt;
FYI there is a related post on &lt;a href="http://sedodream.com/2012/06/07/VSPublishDialogUpdateDatabaseDialogDisabled.aspx"&gt;why
the Update database checkbox&lt;/a&gt; is disabled in the publish dialog which you may be
interested in.
&lt;/p&gt;
&lt;p&gt;
If you have any questions please feel free to directly reach out to me at sayedha(at){MicrosoftDOTCom}.
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi &lt;a href="https://twitter.com/#!/sayedihashimi"&gt;@SayedIHashimi&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,6021286d-1d57-49d6-af59-53a812c4ceb8.aspx</comments>
      <category>Microsoft</category>
      <category>Visual Studio</category>
      <category>Visual Studio 2010</category>
      <category>Web Publishing Pipeline</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=d9d1333e-0ff0-4fb4-b92a-72631e92442f</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,d9d1333e-0ff0-4fb4-b92a-72631e92442f.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,d9d1333e-0ff0-4fb4-b92a-72631e92442f.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=d9d1333e-0ff0-4fb4-b92a-72631e92442f</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The other day I saw a question on StackOverflow (link in resources below) asking How
you can create a Web Deploy (AKA MSDeploy) package when publishing a ClickOnce project.
The easiest way to do this is to use the Web Deploy command line utility, msdeploy.exe.
With the command line you can easily create an MSDeploy package from a folder with
a command like the following:
</p>
        <pre class="brush: csharp;">    %msdeploy% 
      -verb:sync 
      -source:contentPath="C:\Temp\_NET\WebPackageWithClickOnce\WebPackageWithClickOnce\bin\Debug\app.publish" 
      -dest:package="C:\Temp\_NET\WebPackageWithClickOnce\WebPackageWithClickOnce\bin\Debug\co-pkg.zip"</pre>
        <p>
 
</p>
        <p>
Here you can see that I’m using the sync verb, along with a contentPath provider (<em>which
points to a folder</em>) as the source and the destination is using the package provider,
this point to where I want the package to be stored.
</p>
        <p>
Now that we understand how to create an MSDeploy package from a folder we need to
extend the ClickOnce publish process to create a package. I’m not a ClickOnce expert,
but the ClickOnce publish process is captured in MSBuild so after investigating for
a bit I found the following relevant details.
</p>
        <ul>
          <li>
The ClickOnce publish process is contained in the Microsoft.Common.targets file</li>
          <li>
The ClickOnce publish process is tied together through the <strong>Publish</strong> target</li>
          <li>
ClickOnce prepares the files to be published in a folder under bin named app.publish
which is governed by the MSBuild property <strong>PublishDir</strong></li>
        </ul>
        <p>
Now that we know what target to extend as well as what property we can use to refer
to the folder which has the content we can complete sample. We need to edit the project
file. Below is the full contents which I have placed at the bottom of the project
file (right above &lt;/Project&gt;).
</p>
        <pre class="brush: xml;">  &lt;PropertyGroup&gt;
    &lt;WebDeployPackageName Condition=" '$(WebDeployPackageName)'=='' "&gt;$(MSBuildProjectName).zip&lt;/WebDeployPackageName&gt;
    &lt;!--Unless specified otherwise, the tools will go to HKLM\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\1 to get the installpath for msdeploy.exe.--&gt;
    &lt;MSDeployPath Condition="'$(MSDeployPath)'==''"&gt;$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\3@InstallPath)&lt;/MSDeployPath&gt;
    &lt;MSDeployPath Condition="'$(MSDeployPath)'==''"&gt;$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\2@InstallPath)&lt;/MSDeployPath&gt;
    &lt;MSDeployPath Condition="'$(MSDeployPath)'==''"&gt;$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\1@InstallPath)&lt;/MSDeployPath&gt;
    &lt;MSDeployExe Condition=" '$(MSDeployExe)'=='' "&gt;$(MSDeployPath)msdeploy.exe&lt;/MSDeployExe&gt;
  &lt;/PropertyGroup&gt;
  &lt;Target Name="CreateWebDeployPackage" AfterTargets="Publish" DependsOnTargets="Publish"&gt;
    &lt;!--
    %msdeploy% 
      -verb:sync 
      -source:contentPath="C:\Temp\_NET\WebPackageWithClickOnce\WebPackageWithClickOnce\bin\Debug\app.publish" 
      -dest:package="C:\Temp\_NET\WebPackageWithClickOnce\WebPackageWithClickOnce\bin\Debug\co-pkg.zip"
      --&gt;
    &lt;PropertyGroup&gt;
      &lt;Cmd&gt;"$(MSDeployExe)" -verb:sync -source:contentPath="$(MSBuildProjectDirectory)\$(PublishDir)" -dest:package="$(OutDir)$(WebDeployPackageName)"&lt;/Cmd&gt;
    &lt;/PropertyGroup&gt;
    &lt;Message Text="Creating web deploy package with command: $(Cmd)" /&gt;
    &lt;Exec Command="$(Cmd)" /&gt;
  &lt;/Target&gt;</pre>
        <p>
Here I’ve created a couple properties as well as a new target, CreateWebDeployPackage.
I have declared the property WebDeployPackageName which will be the name (excluding
path) of the Web Deploy package which gets created. This defaults to the name of the
project, but you can override it if you want. Next I define the property, MSDeployPath,
which points to msdeploy.exe. It will pick the latest version.
</p>
        <p>
The CreateWebDeployPackage target just constructs the full command line call which
needs to be executed and invokes it using the Exec MSBuild task. There are a couple
subtle details on the target itself though which are worth pointing out. The target
has declared <strong>AfterTargets=”Publish”</strong> which means that it will be invoked
after the Publish target. It also declares <strong>DependsOnTargets=”Publish”</strong>.
Which means that whenever the target gets invoked that Publish will need to be executed
before <strong>CreateWebDeployPackage</strong>. 
</p>
        <p>
Now that we have defined these updates when you publish your ClickOnce project (wither
through Visual Studio or the command line/build servers) a Web Deploy package will
be generated in the output folder which you can use to incrementally publish your
ClickOnce app to your web server. You can find the latest version of this sample on
my <a href="https://github.com/sayedihashimi/sayed-samples/tree/master/ClickOnceCreateWebPackage">github
repository</a>.
</p>
        <p>
Sayed Ibrahim Hashimi <a href="https://twitter.com/#!/sayedihashimi">@SayedIHashimi</a></p>
        <p>
Resources
</p>
        <ul>
          <li>
StackOverflow question: <a href="http://stackoverflow.com/q/9292986/105999">Create
a clickonce webdeploy package</a></li>
          <li>
            <a href="http://technet.microsoft.com/en-us/library/dd569106(WS.10).aspx">MSDeploy.exe
verb</a>
          </li>
          <li>
            <a href="http://technet.microsoft.com/en-us/library/dd569034(WS.10).aspx">MSDeploy
contentPath provider</a>
          </li>
          <li>
            <a href="http://technet.microsoft.com/en-us/library/dd569019(WS.10).aspx">MSDeploy
package provider</a>
          </li>
          <li>
            <a href="http://msdn.microsoft.com/en-us/library/x8zx72cd.aspx">MSBuild Exec task</a>
          </li>
        </ul>
      </body>
      <title>How to create a Web Deploy package when publishing a ClickOnce project</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,d9d1333e-0ff0-4fb4-b92a-72631e92442f.aspx</guid>
      <link>http://sedodream.com/2012/02/18/HowToCreateAWebDeployPackageWhenPublishingAClickOnceProject.aspx</link>
      <pubDate>Sat, 18 Feb 2012 18:47:30 GMT</pubDate>
      <description>&lt;p&gt;
The other day I saw a question on StackOverflow (link in resources below) asking How
you can create a Web Deploy (AKA MSDeploy) package when publishing a ClickOnce project.
The easiest way to do this is to use the Web Deploy command line utility, msdeploy.exe.
With the command line you can easily create an MSDeploy package from a folder with
a command like the following:
&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;    %msdeploy% 
      -verb:sync 
      -source:contentPath=&amp;quot;C:\Temp\_NET\WebPackageWithClickOnce\WebPackageWithClickOnce\bin\Debug\app.publish&amp;quot; 
      -dest:package=&amp;quot;C:\Temp\_NET\WebPackageWithClickOnce\WebPackageWithClickOnce\bin\Debug\co-pkg.zip&amp;quot;&lt;/pre&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
Here you can see that I’m using the sync verb, along with a contentPath provider (&lt;em&gt;which
points to a folder&lt;/em&gt;) as the source and the destination is using the package provider,
this point to where I want the package to be stored.
&lt;/p&gt;
&lt;p&gt;
Now that we understand how to create an MSDeploy package from a folder we need to
extend the ClickOnce publish process to create a package. I’m not a ClickOnce expert,
but the ClickOnce publish process is captured in MSBuild so after investigating for
a bit I found the following relevant details.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
The ClickOnce publish process is contained in the Microsoft.Common.targets file&lt;/li&gt;
&lt;li&gt;
The ClickOnce publish process is tied together through the &lt;strong&gt;Publish&lt;/strong&gt; target&lt;/li&gt;
&lt;li&gt;
ClickOnce prepares the files to be published in a folder under bin named app.publish
which is governed by the MSBuild property &lt;strong&gt;PublishDir&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Now that we know what target to extend as well as what property we can use to refer
to the folder which has the content we can complete sample. We need to edit the project
file. Below is the full contents which I have placed at the bottom of the project
file (right above &amp;lt;/Project&amp;gt;).
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;  &amp;lt;PropertyGroup&amp;gt;
    &amp;lt;WebDeployPackageName Condition=&amp;quot; '$(WebDeployPackageName)'=='' &amp;quot;&amp;gt;$(MSBuildProjectName).zip&amp;lt;/WebDeployPackageName&amp;gt;
    &amp;lt;!--Unless specified otherwise, the tools will go to HKLM\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\1 to get the installpath for msdeploy.exe.--&amp;gt;
    &amp;lt;MSDeployPath Condition=&amp;quot;'$(MSDeployPath)'==''&amp;quot;&amp;gt;$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\3@InstallPath)&amp;lt;/MSDeployPath&amp;gt;
    &amp;lt;MSDeployPath Condition=&amp;quot;'$(MSDeployPath)'==''&amp;quot;&amp;gt;$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\2@InstallPath)&amp;lt;/MSDeployPath&amp;gt;
    &amp;lt;MSDeployPath Condition=&amp;quot;'$(MSDeployPath)'==''&amp;quot;&amp;gt;$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\1@InstallPath)&amp;lt;/MSDeployPath&amp;gt;
    &amp;lt;MSDeployExe Condition=&amp;quot; '$(MSDeployExe)'=='' &amp;quot;&amp;gt;$(MSDeployPath)msdeploy.exe&amp;lt;/MSDeployExe&amp;gt;
  &amp;lt;/PropertyGroup&amp;gt;
  &amp;lt;Target Name=&amp;quot;CreateWebDeployPackage&amp;quot; AfterTargets=&amp;quot;Publish&amp;quot; DependsOnTargets=&amp;quot;Publish&amp;quot;&amp;gt;
    &amp;lt;!--
    %msdeploy% 
      -verb:sync 
      -source:contentPath=&amp;quot;C:\Temp\_NET\WebPackageWithClickOnce\WebPackageWithClickOnce\bin\Debug\app.publish&amp;quot; 
      -dest:package=&amp;quot;C:\Temp\_NET\WebPackageWithClickOnce\WebPackageWithClickOnce\bin\Debug\co-pkg.zip&amp;quot;
      --&amp;gt;
    &amp;lt;PropertyGroup&amp;gt;
      &amp;lt;Cmd&amp;gt;&amp;quot;$(MSDeployExe)&amp;quot; -verb:sync -source:contentPath=&amp;quot;$(MSBuildProjectDirectory)\$(PublishDir)&amp;quot; -dest:package=&amp;quot;$(OutDir)$(WebDeployPackageName)&amp;quot;&amp;lt;/Cmd&amp;gt;
    &amp;lt;/PropertyGroup&amp;gt;
    &amp;lt;Message Text=&amp;quot;Creating web deploy package with command: $(Cmd)&amp;quot; /&amp;gt;
    &amp;lt;Exec Command=&amp;quot;$(Cmd)&amp;quot; /&amp;gt;
  &amp;lt;/Target&amp;gt;&lt;/pre&gt;
&lt;p&gt;
Here I’ve created a couple properties as well as a new target, CreateWebDeployPackage.
I have declared the property WebDeployPackageName which will be the name (excluding
path) of the Web Deploy package which gets created. This defaults to the name of the
project, but you can override it if you want. Next I define the property, MSDeployPath,
which points to msdeploy.exe. It will pick the latest version.
&lt;/p&gt;
&lt;p&gt;
The CreateWebDeployPackage target just constructs the full command line call which
needs to be executed and invokes it using the Exec MSBuild task. There are a couple
subtle details on the target itself though which are worth pointing out. The target
has declared &lt;strong&gt;AfterTargets=”Publish”&lt;/strong&gt; which means that it will be invoked
after the Publish target. It also declares &lt;strong&gt;DependsOnTargets=”Publish”&lt;/strong&gt;.
Which means that whenever the target gets invoked that Publish will need to be executed
before &lt;strong&gt;CreateWebDeployPackage&lt;/strong&gt;. 
&lt;/p&gt;
&lt;p&gt;
Now that we have defined these updates when you publish your ClickOnce project (wither
through Visual Studio or the command line/build servers) a Web Deploy package will
be generated in the output folder which you can use to incrementally publish your
ClickOnce app to your web server. You can find the latest version of this sample on
my &lt;a href="https://github.com/sayedihashimi/sayed-samples/tree/master/ClickOnceCreateWebPackage"&gt;github
repository&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi &lt;a href="https://twitter.com/#!/sayedihashimi"&gt;@SayedIHashimi&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Resources
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
StackOverflow question: &lt;a href="http://stackoverflow.com/q/9292986/105999"&gt;Create
a clickonce webdeploy package&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://technet.microsoft.com/en-us/library/dd569106(WS.10).aspx"&gt;MSDeploy.exe
verb&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://technet.microsoft.com/en-us/library/dd569034(WS.10).aspx"&gt;MSDeploy
contentPath provider&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://technet.microsoft.com/en-us/library/dd569019(WS.10).aspx"&gt;MSDeploy
package provider&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://msdn.microsoft.com/en-us/library/x8zx72cd.aspx"&gt;MSBuild Exec task&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,d9d1333e-0ff0-4fb4-b92a-72631e92442f.aspx</comments>
      <category>ClickOnce</category>
      <category>IIS</category>
      <category>Microsoft</category>
      <category>MSBuild</category>
      <category>MSDeploy</category>
      <category>web</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=bc2ced18-9064-4f51-9167-05ec5595291c</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,bc2ced18-9064-4f51-9167-05ec5595291c.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,bc2ced18-9064-4f51-9167-05ec5595291c.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=bc2ced18-9064-4f51-9167-05ec5595291c</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I received a customer email asking how they can take their web application/site offline
for the entire duration that a publish is happening from Visual Studio. An easy way
to take your site offline is to drop an app_offline.htm file in the sites root directory.
For more info on that you can read ScottGu’s post, link in below in resources section.
Unfortunately Web Deploy itself doesn’t support this <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-sadsmile" alt="Sad smile" src="http://sedodream.com/content/binary/Windows-Live-Writer/c7d918859eb1_A669/wlEmoticon-sadsmile_2.png" />.
If you want Web Deploy (aka MSDeploy) to natively support this feature please vote
on it at <a href="http://aspnet.uservoice.com/forums/41199-general/suggestions/2499911-take-my-site-app-offline-during-publishing">http://aspnet.uservoice.com/forums/41199-general/suggestions/2499911-take-my-site-app-offline-during-publishing</a>. 
</p>
        <p>
Since Web Deploy doesn’t support this it’s going to be a bit more difficult and it
requires us to perform the following steps:
</p>
        <ol>
          <li>
Publish app_offline.htm</li>
          <li>
Publish the app, and ensure that app_offline.htm is contained inside the payload being
published</li>
          <li>
Delete app_offline.htm</li>
        </ol>
        <p>
#1 will take the app offline before the publish process  begins. 
<br />
#2 will ensure that when we publish that app_offline.htm is not deleted (and therefore
keep the app offline) 
<br />
#3 will delete the app_offline.htm and bring the site back online
</p>
        <p>
Now that we know what needs to be done let’s look at the implementation. First for
the easy part. Create a file in your Web Application Project (WAP) named app_offline-template.htm.
This will be the file which will end up being the app_offline.htm file on your target
server. If you leave it blank your users will get a generic message stating that the
app is offline, but it would be better for you to place <strong>static HTML</strong> (<em>no
ASP.NET markup</em>) inside of that file letting users know that the site will come
back up and whatever other info you think is relevant to your users. When you add
this file you should change the Build Action to None in the Properties grid. This
will make sure that this file itself is not published/packaged. Since the file ends
in .htm it will by default be published. See the image below.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/c7d918859eb1_A669/image_2.png">
            <img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/c7d918859eb1_A669/image_thumb.png" width="288" height="380" />
          </a>
        </p>
        <p>
Now for the hard part. For Web Application Projects we have a hook into the publish/package
process which we refer to as “wpp.targets”. If you want to extend your publish/package
process you can create a file named {ProjectName}.wpp.targets in the same folder as
the project file itself. Here is the file which I created you can copy and paste the
content into your wpp.targets file. I will explain the significant parts but wanted
to post the entire file for your convince. <em>Note: you can grab my latest version
of this file from my github repo, the link is in the resource section below.</em></p>
        <pre class="brush: xml;">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
  &lt;Target Name="InitalizeAppOffline"&gt;
    &lt;!-- 
    This property needs to be declared inside of target because this is imported before
    the MSDeployPath property is defined as well as others --&gt;
    &lt;PropertyGroup&gt;
      &lt;MSDeployExe Condition=" '$(MSDeployExe)'=='' "&gt;$(MSDeployPath)msdeploy.exe&lt;/MSDeployExe&gt;
    &lt;/PropertyGroup&gt;    
  &lt;/Target&gt;

  &lt;PropertyGroup&gt;
    &lt;PublishAppOfflineToDest&gt;
      InitalizeAppOffline;
    &lt;/PublishAppOfflineToDest&gt;
  &lt;/PropertyGroup&gt;

  &lt;!--
    %msdeploy% 
      -verb:sync 
      -source:contentPath="C:\path\to\app_offline-template.htm" 
      -dest:contentPath="Default Web Site/AppOfflineDemo/app_offline.htm"
  --&gt;

  &lt;!--***********************************************************************
  Make sure app_offline-template.htm gets published as app_offline.htm
  ***************************************************************************--&gt;
  &lt;Target Name="PublishAppOfflineToDest" 
          BeforeTargets="MSDeployPublish" 
          DependsOnTargets="$(PublishAppOfflineToDest)"&gt;
    &lt;ItemGroup&gt;
      &lt;_AoPubAppOfflineSourceProviderSetting Include="contentPath"&gt;
        &lt;Path&gt;$(MSBuildProjectDirectory)\app_offline-template.htm&lt;/Path&gt;
        &lt;EncryptPassword&gt;$(DeployEncryptKey)&lt;/EncryptPassword&gt;
        &lt;WebServerAppHostConfigDirectory&gt;$(_MSDeploySourceWebServerAppHostConfigDirectory)&lt;/WebServerAppHostConfigDirectory&gt;
        &lt;WebServerManifest&gt;$(_MSDeploySourceWebServerManifest)&lt;/WebServerManifest&gt;
        &lt;WebServerDirectory&gt;$(_MSDeploySourceWebServerDirectory)&lt;/WebServerDirectory&gt;
      &lt;/_AoPubAppOfflineSourceProviderSetting&gt;

      &lt;_AoPubAppOfflineDestProviderSetting Include="contentPath"&gt;
        &lt;Path&gt;"$(DeployIisAppPath)/app_offline.htm"&lt;/Path&gt;
        &lt;ComputerName&gt;$(_PublishMsDeployServiceUrl)&lt;/ComputerName&gt;
        &lt;UserName&gt;$(UserName)&lt;/UserName&gt;
        &lt;Password&gt;$(Password)&lt;/Password&gt;
        &lt;EncryptPassword&gt;$(DeployEncryptKey)&lt;/EncryptPassword&gt;
        &lt;IncludeAcls&gt;False&lt;/IncludeAcls&gt;
        &lt;AuthType&gt;$(AuthType)&lt;/AuthType&gt;
        &lt;WebServerAppHostConfigDirectory&gt;$(_MSDeployDestinationWebServerAppHostConfigDirectory)&lt;/WebServerAppHostConfigDirectory&gt;
        &lt;WebServerManifest&gt;$(_MSDeployDestinationWebServerManifest)&lt;/WebServerManifest&gt;
        &lt;WebServerDirectory&gt;$(_MSDeployDestinationWebServerDirectory)&lt;/WebServerDirectory&gt;
      &lt;/_AoPubAppOfflineDestProviderSetting&gt;
    &lt;/ItemGroup&gt;

    &lt;MSdeploy
          MSDeployVersionsToTry="$(_MSDeployVersionsToTry)"
          Verb="sync"
          Source="@(_AoPubAppOfflineSourceProviderSetting)"
          Destination="@(_AoPubAppOfflineDestProviderSetting)"
          EnableRule="DoNotDeleteRule"
          AllowUntrusted="$(AllowUntrustedCertificate)"
          RetryAttempts="$(RetryAttemptsForDeployment)"
          SimpleSetParameterItems="@(_AoArchivePublishSetParam)"
          ExePath="$(MSDeployPath)" /&gt;
  &lt;/Target&gt;

  &lt;!--***********************************************************************
  Make sure app_offline-template.htm gets published as app_offline.htm
  ***************************************************************************--&gt;
  &lt;!-- We need to create a replace rule for app_offline-template.htm-&gt;app_offline.htm for when the app get's published --&gt;
  &lt;ItemGroup&gt;
    &lt;!-- Make sure not to include this file if a package is being created, so condition this on publishing --&gt;
    &lt;FilesForPackagingFromProject Include="app_offline-template.htm" Condition=" '$(DeployTarget)'=='MSDeployPublish' "&gt;
      &lt;DestinationRelativePath&gt;app_offline.htm&lt;/DestinationRelativePath&gt;
    &lt;/FilesForPackagingFromProject&gt;

    &lt;!-- This will prevent app_offline-template.htm from being published --&gt;
    &lt;MsDeploySkipRules Include="SkipAppOfflineTemplate"&gt;
      &lt;ObjectName&gt;filePath&lt;/ObjectName&gt;
      &lt;AbsolutePath&gt;app_offline-template.htm&lt;/AbsolutePath&gt;
    &lt;/MsDeploySkipRules&gt;
  &lt;/ItemGroup&gt;

  &lt;!--***********************************************************************
  When publish is completed we need to delete the app_offline.htm
  ***************************************************************************--&gt;
  &lt;Target Name="DeleteAppOffline" AfterTargets="MSDeployPublish"&gt;
    &lt;!--
    %msdeploy% 
      -verb:delete 
      -dest:contentPath="{IIS-Path}/app_offline.htm",computerName="...",username="...",password="..."
    --&gt;
    &lt;Message Text="************************************************************************" /&gt;
    &lt;Message Text="Calling MSDeploy to delete the app_offline.htm file" Importance="high" /&gt;
    &lt;Message Text="************************************************************************" /&gt;

    &lt;ItemGroup&gt;
      &lt;_AoDeleteAppOfflineDestProviderSetting Include="contentPath"&gt;
        &lt;Path&gt;$(DeployIisAppPath)/app_offline.htm&lt;/Path&gt;
        &lt;ComputerName&gt;$(_PublishMsDeployServiceUrl)&lt;/ComputerName&gt;
        &lt;UserName&gt;$(UserName)&lt;/UserName&gt;
        &lt;Password&gt;$(Password)&lt;/Password&gt;
        &lt;EncryptPassword&gt;$(DeployEncryptKey)&lt;/EncryptPassword&gt;
        &lt;AuthType&gt;$(AuthType)&lt;/AuthType&gt;
        &lt;WebServerAppHostConfigDirectory&gt;$(_MSDeployDestinationWebServerAppHostConfigDirectory)&lt;/WebServerAppHostConfigDirectory&gt;
        &lt;WebServerManifest&gt;$(_MSDeployDestinationWebServerManifest)&lt;/WebServerManifest&gt;
        &lt;WebServerDirectory&gt;$(_MSDeployDestinationWebServerDirectory)&lt;/WebServerDirectory&gt;
      &lt;/_AoDeleteAppOfflineDestProviderSetting&gt;
    &lt;/ItemGroup&gt;
    
    &lt;!-- 
    We cannot use the MSDeploy/VSMSDeploy tasks for delete so we have to call msdeploy.exe directly.
    When they support delete we can just pass in @(_AoDeleteAppOfflineDestProviderSetting) as the dest
    --&gt;
    &lt;PropertyGroup&gt;
      &lt;_Cmd&gt;"$(MSDeployExe)" -verb:delete -dest:contentPath="%(_AoDeleteAppOfflineDestProviderSetting.Path)"&lt;/_Cmd&gt;
      &lt;_Cmd Condition=" '%(_AoDeleteAppOfflineDestProviderSetting.ComputerName)' != '' "&gt;$(_Cmd),computerName="%(_AoDeleteAppOfflineDestProviderSetting.ComputerName)"&lt;/_Cmd&gt;
      &lt;_Cmd Condition=" '%(_AoDeleteAppOfflineDestProviderSetting.UserName)' != '' "&gt;$(_Cmd),username="%(_AoDeleteAppOfflineDestProviderSetting.UserName)"&lt;/_Cmd&gt;
      &lt;_Cmd Condition=" '%(_AoDeleteAppOfflineDestProviderSetting.Password)' != ''"&gt;$(_Cmd),password=$(Password)&lt;/_Cmd&gt;
      &lt;_Cmd Condition=" '%(_AoDeleteAppOfflineDestProviderSetting.AuthType)' != ''"&gt;$(_Cmd),authType="%(_AoDeleteAppOfflineDestProviderSetting.AuthType)"&lt;/_Cmd&gt;
    &lt;/PropertyGroup&gt;

    &lt;Exec Command="$(_Cmd)"/&gt;
  &lt;/Target&gt;  
&lt;/Project&gt;</pre>
        <h3>#1 Publish app_offline.htm
</h3>
        <p>
The implementation for #1 is contained inside the target PublishAppOfflineToDest.
The msdeploy.exe command that we need to get executed is.
</p>
        <p>
          <strong>msdeploy.exe 
<br />
    -source:contentPath='C:\Data\Personal\My Repo\sayed-samples\AppOfflineDemo01\AppOfflineDemo01\app_offline-template.htm' 
<br />
    -dest:contentPath='"Default Web Site/AppOfflineDemo/app_offline.htm"',UserName='sayedha',Password='password-here',ComputerName='computername-here',IncludeAcls='False',AuthType='NTLM'
-verb:sync -enableRule:DoNotDeleteRule</strong>
        </p>
        <p>
In order to do this I will leverage the MSDeploy task. Inside of the PublishAppOfflineToDest
target you can see how this is accomplished by creating an item for both the source
and destination.
</p>
        <h3>#2 Publish the app, and ensure that app_offline.htm is contained inside the payload
being published
</h3>
        <p>
This part is accomplished by the fragment
</p>
        <pre class="brush: xml;">  &lt;!--***********************************************************************
  Make sure app_offline-template.htm gets published as app_offline.htm
  ***************************************************************************--&gt;
  &lt;!-- We need to create a replace rule for app_offline-template.htm-&gt;app_offline.htm for when the app get's published --&gt;
  &lt;ItemGroup&gt;
    &lt;!-- Make sure not to include this file if a package is being created, so condition this on publishing --&gt;
    &lt;FilesForPackagingFromProject Include="app_offline-template.htm" Condition=" '$(DeployTarget)'=='MSDeployPublish' "&gt;
      &lt;DestinationRelativePath&gt;app_offline.htm&lt;/DestinationRelativePath&gt;
    &lt;/FilesForPackagingFromProject&gt;

    &lt;!-- This will prevent app_offline-template.htm from being published --&gt;
    &lt;MsDeploySkipRules Include="SkipAppOfflineTemplate"&gt;
      &lt;ObjectName&gt;filePath&lt;/ObjectName&gt;
      &lt;AbsolutePath&gt;app_offline-template.htm&lt;/AbsolutePath&gt;
    &lt;/MsDeploySkipRules&gt;
  &lt;/ItemGroup&gt;</pre>
        <p>
The item value for FilesForPackagingFromProject here will convert your app_offline-template.htm
to app_offline.htm in the folder from where the publish will be processed. Also there
is a condition on it so that it only happens during publish and not packaging. We
do not want app_offline-template.htm to be in the package (<em>but it’s not the end
of the world if it does either</em>).
</p>
        <p>
The element for MsDeploySkiprules will make sure that app_offline-template.htm itself
doesn’t get published. This may not be required but it shouldn’t hurt.
</p>
        <h3>#3 Delete app_offline.htm
</h3>
        <p>
Now that our app is published we need to delete the app_offline.htm file from the
dest web app. The msdeploy.exe command would be:
</p>
        <p>
%msdeploy% 
<br />
      -verb:delete 
<br />
      -dest:contentPath="{IIS-Path}/app_offline.htm",computerName="...",username="...",password="..." 
<br /></p>
        <p>
This is implemented inside of the DeleteAppOffline target. This target will automatically
get executed after the publish because I have included the attribute <strong>AfterTargets=”MSDeployPublish”</strong>.
In that target you can see that I am building up the msdeploy.exe command directly,
it looks like the MSDeploy task doesn’t support the delete verb. 
</p>
        <p>
If you do try this out please let me know if you run into any issues. I am thinking
to create a Nuget package from this so that you can just install that package. That
would take a bit of work so please let me know if you are interested in that.
</p>
        <h3>Resources
</h3>
        <ol>
          <li>
            <a href="https://github.com/sayedihashimi/sayed-samples/blob/master/AppOfflineDemo01/AppOfflineDemo01/AppOfflineDemo01.wpp.targets">The
latest version of my AppOffline wpp.targets file.</a>
          </li>
          <li>
            <a href="http://weblogs.asp.net/scottgu/archive/2006/04/09/442332.aspx">ScottGu’s
blog on app_offline.htm</a>
          </li>
        </ol>
        <p>
 
</p>
        <p>
Sayed Ibrahim Hashimi <a href="https://twitter.com/#!/sayedihashimi">@SayedIHashimi</a></p>
      </body>
      <title>How to take your web app offline during publishing</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,bc2ced18-9064-4f51-9167-05ec5595291c.aspx</guid>
      <link>http://sedodream.com/2012/01/08/HowToTakeYourWebAppOfflineDuringPublishing.aspx</link>
      <pubDate>Sun, 08 Jan 2012 20:44:39 GMT</pubDate>
      <description>&lt;p&gt;
I received a customer email asking how they can take their web application/site offline
for the entire duration that a publish is happening from Visual Studio. An easy way
to take your site offline is to drop an app_offline.htm file in the sites root directory.
For more info on that you can read ScottGu’s post, link in below in resources section.
Unfortunately Web Deploy itself doesn’t support this &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-sadsmile" alt="Sad smile" src="http://sedodream.com/content/binary/Windows-Live-Writer/c7d918859eb1_A669/wlEmoticon-sadsmile_2.png" /&gt;.
If you want Web Deploy (aka MSDeploy) to natively support this feature please vote
on it at &lt;a href="http://aspnet.uservoice.com/forums/41199-general/suggestions/2499911-take-my-site-app-offline-during-publishing"&gt;http://aspnet.uservoice.com/forums/41199-general/suggestions/2499911-take-my-site-app-offline-during-publishing&lt;/a&gt;. 
&lt;/p&gt;
&lt;p&gt;
Since Web Deploy doesn’t support this it’s going to be a bit more difficult and it
requires us to perform the following steps:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Publish app_offline.htm&lt;/li&gt;
&lt;li&gt;
Publish the app, and ensure that app_offline.htm is contained inside the payload being
published&lt;/li&gt;
&lt;li&gt;
Delete app_offline.htm&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
#1 will take the app offline before the publish process&amp;#160; begins. 
&lt;br /&gt;
#2 will ensure that when we publish that app_offline.htm is not deleted (and therefore
keep the app offline) 
&lt;br /&gt;
#3 will delete the app_offline.htm and bring the site back online
&lt;/p&gt;
&lt;p&gt;
Now that we know what needs to be done let’s look at the implementation. First for
the easy part. Create a file in your Web Application Project (WAP) named app_offline-template.htm.
This will be the file which will end up being the app_offline.htm file on your target
server. If you leave it blank your users will get a generic message stating that the
app is offline, but it would be better for you to place &lt;strong&gt;static HTML&lt;/strong&gt; (&lt;em&gt;no
ASP.NET markup&lt;/em&gt;) inside of that file letting users know that the site will come
back up and whatever other info you think is relevant to your users. When you add
this file you should change the Build Action to None in the Properties grid. This
will make sure that this file itself is not published/packaged. Since the file ends
in .htm it will by default be published. See the image below.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/c7d918859eb1_A669/image_2.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/c7d918859eb1_A669/image_thumb.png" width="288" height="380" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Now for the hard part. For Web Application Projects we have a hook into the publish/package
process which we refer to as “wpp.targets”. If you want to extend your publish/package
process you can create a file named {ProjectName}.wpp.targets in the same folder as
the project file itself. Here is the file which I created you can copy and paste the
content into your wpp.targets file. I will explain the significant parts but wanted
to post the entire file for your convince. &lt;em&gt;Note: you can grab my latest version
of this file from my github repo, the link is in the resource section below.&lt;/em&gt;
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;
&amp;lt;Project xmlns=&amp;quot;http://schemas.microsoft.com/developer/msbuild/2003&amp;quot;&amp;gt;
  &amp;lt;Target Name=&amp;quot;InitalizeAppOffline&amp;quot;&amp;gt;
    &amp;lt;!-- 
    This property needs to be declared inside of target because this is imported before
    the MSDeployPath property is defined as well as others --&amp;gt;
    &amp;lt;PropertyGroup&amp;gt;
      &amp;lt;MSDeployExe Condition=&amp;quot; '$(MSDeployExe)'=='' &amp;quot;&amp;gt;$(MSDeployPath)msdeploy.exe&amp;lt;/MSDeployExe&amp;gt;
    &amp;lt;/PropertyGroup&amp;gt;    
  &amp;lt;/Target&amp;gt;

  &amp;lt;PropertyGroup&amp;gt;
    &amp;lt;PublishAppOfflineToDest&amp;gt;
      InitalizeAppOffline;
    &amp;lt;/PublishAppOfflineToDest&amp;gt;
  &amp;lt;/PropertyGroup&amp;gt;

  &amp;lt;!--
    %msdeploy% 
      -verb:sync 
      -source:contentPath=&amp;quot;C:\path\to\app_offline-template.htm&amp;quot; 
      -dest:contentPath=&amp;quot;Default Web Site/AppOfflineDemo/app_offline.htm&amp;quot;
  --&amp;gt;

  &amp;lt;!--***********************************************************************
  Make sure app_offline-template.htm gets published as app_offline.htm
  ***************************************************************************--&amp;gt;
  &amp;lt;Target Name=&amp;quot;PublishAppOfflineToDest&amp;quot; 
          BeforeTargets=&amp;quot;MSDeployPublish&amp;quot; 
          DependsOnTargets=&amp;quot;$(PublishAppOfflineToDest)&amp;quot;&amp;gt;
    &amp;lt;ItemGroup&amp;gt;
      &amp;lt;_AoPubAppOfflineSourceProviderSetting Include=&amp;quot;contentPath&amp;quot;&amp;gt;
        &amp;lt;Path&amp;gt;$(MSBuildProjectDirectory)\app_offline-template.htm&amp;lt;/Path&amp;gt;
        &amp;lt;EncryptPassword&amp;gt;$(DeployEncryptKey)&amp;lt;/EncryptPassword&amp;gt;
        &amp;lt;WebServerAppHostConfigDirectory&amp;gt;$(_MSDeploySourceWebServerAppHostConfigDirectory)&amp;lt;/WebServerAppHostConfigDirectory&amp;gt;
        &amp;lt;WebServerManifest&amp;gt;$(_MSDeploySourceWebServerManifest)&amp;lt;/WebServerManifest&amp;gt;
        &amp;lt;WebServerDirectory&amp;gt;$(_MSDeploySourceWebServerDirectory)&amp;lt;/WebServerDirectory&amp;gt;
      &amp;lt;/_AoPubAppOfflineSourceProviderSetting&amp;gt;

      &amp;lt;_AoPubAppOfflineDestProviderSetting Include=&amp;quot;contentPath&amp;quot;&amp;gt;
        &amp;lt;Path&amp;gt;&amp;quot;$(DeployIisAppPath)/app_offline.htm&amp;quot;&amp;lt;/Path&amp;gt;
        &amp;lt;ComputerName&amp;gt;$(_PublishMsDeployServiceUrl)&amp;lt;/ComputerName&amp;gt;
        &amp;lt;UserName&amp;gt;$(UserName)&amp;lt;/UserName&amp;gt;
        &amp;lt;Password&amp;gt;$(Password)&amp;lt;/Password&amp;gt;
        &amp;lt;EncryptPassword&amp;gt;$(DeployEncryptKey)&amp;lt;/EncryptPassword&amp;gt;
        &amp;lt;IncludeAcls&amp;gt;False&amp;lt;/IncludeAcls&amp;gt;
        &amp;lt;AuthType&amp;gt;$(AuthType)&amp;lt;/AuthType&amp;gt;
        &amp;lt;WebServerAppHostConfigDirectory&amp;gt;$(_MSDeployDestinationWebServerAppHostConfigDirectory)&amp;lt;/WebServerAppHostConfigDirectory&amp;gt;
        &amp;lt;WebServerManifest&amp;gt;$(_MSDeployDestinationWebServerManifest)&amp;lt;/WebServerManifest&amp;gt;
        &amp;lt;WebServerDirectory&amp;gt;$(_MSDeployDestinationWebServerDirectory)&amp;lt;/WebServerDirectory&amp;gt;
      &amp;lt;/_AoPubAppOfflineDestProviderSetting&amp;gt;
    &amp;lt;/ItemGroup&amp;gt;

    &amp;lt;MSdeploy
          MSDeployVersionsToTry=&amp;quot;$(_MSDeployVersionsToTry)&amp;quot;
          Verb=&amp;quot;sync&amp;quot;
          Source=&amp;quot;@(_AoPubAppOfflineSourceProviderSetting)&amp;quot;
          Destination=&amp;quot;@(_AoPubAppOfflineDestProviderSetting)&amp;quot;
          EnableRule=&amp;quot;DoNotDeleteRule&amp;quot;
          AllowUntrusted=&amp;quot;$(AllowUntrustedCertificate)&amp;quot;
          RetryAttempts=&amp;quot;$(RetryAttemptsForDeployment)&amp;quot;
          SimpleSetParameterItems=&amp;quot;@(_AoArchivePublishSetParam)&amp;quot;
          ExePath=&amp;quot;$(MSDeployPath)&amp;quot; /&amp;gt;
  &amp;lt;/Target&amp;gt;

  &amp;lt;!--***********************************************************************
  Make sure app_offline-template.htm gets published as app_offline.htm
  ***************************************************************************--&amp;gt;
  &amp;lt;!-- We need to create a replace rule for app_offline-template.htm-&amp;gt;app_offline.htm for when the app get's published --&amp;gt;
  &amp;lt;ItemGroup&amp;gt;
    &amp;lt;!-- Make sure not to include this file if a package is being created, so condition this on publishing --&amp;gt;
    &amp;lt;FilesForPackagingFromProject Include=&amp;quot;app_offline-template.htm&amp;quot; Condition=&amp;quot; '$(DeployTarget)'=='MSDeployPublish' &amp;quot;&amp;gt;
      &amp;lt;DestinationRelativePath&amp;gt;app_offline.htm&amp;lt;/DestinationRelativePath&amp;gt;
    &amp;lt;/FilesForPackagingFromProject&amp;gt;

    &amp;lt;!-- This will prevent app_offline-template.htm from being published --&amp;gt;
    &amp;lt;MsDeploySkipRules Include=&amp;quot;SkipAppOfflineTemplate&amp;quot;&amp;gt;
      &amp;lt;ObjectName&amp;gt;filePath&amp;lt;/ObjectName&amp;gt;
      &amp;lt;AbsolutePath&amp;gt;app_offline-template.htm&amp;lt;/AbsolutePath&amp;gt;
    &amp;lt;/MsDeploySkipRules&amp;gt;
  &amp;lt;/ItemGroup&amp;gt;

  &amp;lt;!--***********************************************************************
  When publish is completed we need to delete the app_offline.htm
  ***************************************************************************--&amp;gt;
  &amp;lt;Target Name=&amp;quot;DeleteAppOffline&amp;quot; AfterTargets=&amp;quot;MSDeployPublish&amp;quot;&amp;gt;
    &amp;lt;!--
    %msdeploy% 
      -verb:delete 
      -dest:contentPath=&amp;quot;{IIS-Path}/app_offline.htm&amp;quot;,computerName=&amp;quot;...&amp;quot;,username=&amp;quot;...&amp;quot;,password=&amp;quot;...&amp;quot;
    --&amp;gt;
    &amp;lt;Message Text=&amp;quot;************************************************************************&amp;quot; /&amp;gt;
    &amp;lt;Message Text=&amp;quot;Calling MSDeploy to delete the app_offline.htm file&amp;quot; Importance=&amp;quot;high&amp;quot; /&amp;gt;
    &amp;lt;Message Text=&amp;quot;************************************************************************&amp;quot; /&amp;gt;

    &amp;lt;ItemGroup&amp;gt;
      &amp;lt;_AoDeleteAppOfflineDestProviderSetting Include=&amp;quot;contentPath&amp;quot;&amp;gt;
        &amp;lt;Path&amp;gt;$(DeployIisAppPath)/app_offline.htm&amp;lt;/Path&amp;gt;
        &amp;lt;ComputerName&amp;gt;$(_PublishMsDeployServiceUrl)&amp;lt;/ComputerName&amp;gt;
        &amp;lt;UserName&amp;gt;$(UserName)&amp;lt;/UserName&amp;gt;
        &amp;lt;Password&amp;gt;$(Password)&amp;lt;/Password&amp;gt;
        &amp;lt;EncryptPassword&amp;gt;$(DeployEncryptKey)&amp;lt;/EncryptPassword&amp;gt;
        &amp;lt;AuthType&amp;gt;$(AuthType)&amp;lt;/AuthType&amp;gt;
        &amp;lt;WebServerAppHostConfigDirectory&amp;gt;$(_MSDeployDestinationWebServerAppHostConfigDirectory)&amp;lt;/WebServerAppHostConfigDirectory&amp;gt;
        &amp;lt;WebServerManifest&amp;gt;$(_MSDeployDestinationWebServerManifest)&amp;lt;/WebServerManifest&amp;gt;
        &amp;lt;WebServerDirectory&amp;gt;$(_MSDeployDestinationWebServerDirectory)&amp;lt;/WebServerDirectory&amp;gt;
      &amp;lt;/_AoDeleteAppOfflineDestProviderSetting&amp;gt;
    &amp;lt;/ItemGroup&amp;gt;
    
    &amp;lt;!-- 
    We cannot use the MSDeploy/VSMSDeploy tasks for delete so we have to call msdeploy.exe directly.
    When they support delete we can just pass in @(_AoDeleteAppOfflineDestProviderSetting) as the dest
    --&amp;gt;
    &amp;lt;PropertyGroup&amp;gt;
      &amp;lt;_Cmd&amp;gt;&amp;quot;$(MSDeployExe)&amp;quot; -verb:delete -dest:contentPath=&amp;quot;%(_AoDeleteAppOfflineDestProviderSetting.Path)&amp;quot;&amp;lt;/_Cmd&amp;gt;
      &amp;lt;_Cmd Condition=&amp;quot; '%(_AoDeleteAppOfflineDestProviderSetting.ComputerName)' != '' &amp;quot;&amp;gt;$(_Cmd),computerName=&amp;quot;%(_AoDeleteAppOfflineDestProviderSetting.ComputerName)&amp;quot;&amp;lt;/_Cmd&amp;gt;
      &amp;lt;_Cmd Condition=&amp;quot; '%(_AoDeleteAppOfflineDestProviderSetting.UserName)' != '' &amp;quot;&amp;gt;$(_Cmd),username=&amp;quot;%(_AoDeleteAppOfflineDestProviderSetting.UserName)&amp;quot;&amp;lt;/_Cmd&amp;gt;
      &amp;lt;_Cmd Condition=&amp;quot; '%(_AoDeleteAppOfflineDestProviderSetting.Password)' != ''&amp;quot;&amp;gt;$(_Cmd),password=$(Password)&amp;lt;/_Cmd&amp;gt;
      &amp;lt;_Cmd Condition=&amp;quot; '%(_AoDeleteAppOfflineDestProviderSetting.AuthType)' != ''&amp;quot;&amp;gt;$(_Cmd),authType=&amp;quot;%(_AoDeleteAppOfflineDestProviderSetting.AuthType)&amp;quot;&amp;lt;/_Cmd&amp;gt;
    &amp;lt;/PropertyGroup&amp;gt;

    &amp;lt;Exec Command=&amp;quot;$(_Cmd)&amp;quot;/&amp;gt;
  &amp;lt;/Target&amp;gt;  
&amp;lt;/Project&amp;gt;&lt;/pre&gt;
&lt;h3&gt;#1 Publish app_offline.htm
&lt;/h3&gt;
&lt;p&gt;
The implementation for #1 is contained inside the target PublishAppOfflineToDest.
The msdeploy.exe command that we need to get executed is.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;msdeploy.exe 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; -source:contentPath='C:\Data\Personal\My Repo\sayed-samples\AppOfflineDemo01\AppOfflineDemo01\app_offline-template.htm' 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; -dest:contentPath='&amp;quot;Default Web Site/AppOfflineDemo/app_offline.htm&amp;quot;',UserName='sayedha',Password='password-here',ComputerName='computername-here',IncludeAcls='False',AuthType='NTLM'
-verb:sync -enableRule:DoNotDeleteRule&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
In order to do this I will leverage the MSDeploy task. Inside of the PublishAppOfflineToDest
target you can see how this is accomplished by creating an item for both the source
and destination.
&lt;/p&gt;
&lt;h3&gt;#2 Publish the app, and ensure that app_offline.htm is contained inside the payload
being published
&lt;/h3&gt;
&lt;p&gt;
This part is accomplished by the fragment
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;  &amp;lt;!--***********************************************************************
  Make sure app_offline-template.htm gets published as app_offline.htm
  ***************************************************************************--&amp;gt;
  &amp;lt;!-- We need to create a replace rule for app_offline-template.htm-&amp;gt;app_offline.htm for when the app get's published --&amp;gt;
  &amp;lt;ItemGroup&amp;gt;
    &amp;lt;!-- Make sure not to include this file if a package is being created, so condition this on publishing --&amp;gt;
    &amp;lt;FilesForPackagingFromProject Include=&amp;quot;app_offline-template.htm&amp;quot; Condition=&amp;quot; '$(DeployTarget)'=='MSDeployPublish' &amp;quot;&amp;gt;
      &amp;lt;DestinationRelativePath&amp;gt;app_offline.htm&amp;lt;/DestinationRelativePath&amp;gt;
    &amp;lt;/FilesForPackagingFromProject&amp;gt;

    &amp;lt;!-- This will prevent app_offline-template.htm from being published --&amp;gt;
    &amp;lt;MsDeploySkipRules Include=&amp;quot;SkipAppOfflineTemplate&amp;quot;&amp;gt;
      &amp;lt;ObjectName&amp;gt;filePath&amp;lt;/ObjectName&amp;gt;
      &amp;lt;AbsolutePath&amp;gt;app_offline-template.htm&amp;lt;/AbsolutePath&amp;gt;
    &amp;lt;/MsDeploySkipRules&amp;gt;
  &amp;lt;/ItemGroup&amp;gt;&lt;/pre&gt;
&lt;p&gt;
The item value for FilesForPackagingFromProject here will convert your app_offline-template.htm
to app_offline.htm in the folder from where the publish will be processed. Also there
is a condition on it so that it only happens during publish and not packaging. We
do not want app_offline-template.htm to be in the package (&lt;em&gt;but it’s not the end
of the world if it does either&lt;/em&gt;).
&lt;/p&gt;
&lt;p&gt;
The element for MsDeploySkiprules will make sure that app_offline-template.htm itself
doesn’t get published. This may not be required but it shouldn’t hurt.
&lt;/p&gt;
&lt;h3&gt;#3 Delete app_offline.htm
&lt;/h3&gt;
&lt;p&gt;
Now that our app is published we need to delete the app_offline.htm file from the
dest web app. The msdeploy.exe command would be:
&lt;/p&gt;
&lt;p&gt;
%msdeploy% 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; -verb:delete 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; -dest:contentPath=&amp;quot;{IIS-Path}/app_offline.htm&amp;quot;,computerName=&amp;quot;...&amp;quot;,username=&amp;quot;...&amp;quot;,password=&amp;quot;...&amp;quot; 
&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;
This is implemented inside of the DeleteAppOffline target. This target will automatically
get executed after the publish because I have included the attribute &lt;strong&gt;AfterTargets=”MSDeployPublish”&lt;/strong&gt;.
In that target you can see that I am building up the msdeploy.exe command directly,
it looks like the MSDeploy task doesn’t support the delete verb. 
&lt;/p&gt;
&lt;p&gt;
If you do try this out please let me know if you run into any issues. I am thinking
to create a Nuget package from this so that you can just install that package. That
would take a bit of work so please let me know if you are interested in that.
&lt;/p&gt;
&lt;h3&gt;Resources
&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://github.com/sayedihashimi/sayed-samples/blob/master/AppOfflineDemo01/AppOfflineDemo01/AppOfflineDemo01.wpp.targets"&gt;The
latest version of my AppOffline wpp.targets file.&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://weblogs.asp.net/scottgu/archive/2006/04/09/442332.aspx"&gt;ScottGu’s
blog on app_offline.htm&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi &lt;a href="https://twitter.com/#!/sayedihashimi"&gt;@SayedIHashimi&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,bc2ced18-9064-4f51-9167-05ec5595291c.aspx</comments>
      <category>IIS</category>
      <category>Microsoft</category>
      <category>MSBuild</category>
      <category>MSDeploy</category>
      <category>Visual Studio 2010</category>
      <category>web</category>
      <category>Web Deployment Tool</category>
      <category>Web Publishing Pipeline</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=d1844a46-3319-401a-81f6-b4be5b3bc5c0</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,d1844a46-3319-401a-81f6-b4be5b3bc5c0.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,d1844a46-3319-401a-81f6-b4be5b3bc5c0.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=d1844a46-3319-401a-81f6-b4be5b3bc5c0</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I’m happy to say that I was offered, and accepted, a position on the Web Platform
and Tools team with Microsoft. I will be a <a href="http://blogs.msdn.com/b/techtalk/archive/2005/12/16/504872.aspx">Program
Manager</a> on that team. In a nutshell I will be responsible for helping to make
development easier for web developers using .NET and Visual Studio. Its a very interesting
role and I’m gonna be pretty challenged in the next few months to adapt to my new
role. The Web Platform and Tools team has a bunch of tools that they are responsible
for, and one of the is the <a href="http://www.iis.net/download/webdeploy">Web Deployment
Tool</a>. I think that this will be one of the areas that I will be working in, so
if you have any ideas feel free to drop me a line here or privately at sayed –DOT—hashimi
[AT] gmail –DOT—com. I will start in this role in about 2 weeks.
</p>
        <p>
Sayed Ibrahim Hashimi
</p>
      </body>
      <title>Joining Microsoft</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,d1844a46-3319-401a-81f6-b4be5b3bc5c0.aspx</guid>
      <link>http://sedodream.com/2010/06/10/JoiningMicrosoft.aspx</link>
      <pubDate>Thu, 10 Jun 2010 03:50:30 GMT</pubDate>
      <description>&lt;p&gt;
I’m happy to say that I was offered, and accepted, a position on the Web Platform
and Tools team with Microsoft. I will be a &lt;a href="http://blogs.msdn.com/b/techtalk/archive/2005/12/16/504872.aspx"&gt;Program
Manager&lt;/a&gt; on that team. In a nutshell I will be responsible for helping to make
development easier for web developers using .NET and Visual Studio. Its a very interesting
role and I’m gonna be pretty challenged in the next few months to adapt to my new
role. The Web Platform and Tools team has a bunch of tools that they are responsible
for, and one of the is the &lt;a href="http://www.iis.net/download/webdeploy"&gt;Web Deployment
Tool&lt;/a&gt;. I think that this will be one of the areas that I will be working in, so
if you have any ideas feel free to drop me a line here or privately at sayed –DOT—hashimi
[AT] gmail –DOT—com. I will start in this role in about 2 weeks.
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,d1844a46-3319-401a-81f6-b4be5b3bc5c0.aspx</comments>
      <category>Employment</category>
      <category>Microsoft</category>
    </item>
  </channel>
</rss>