<?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 - MSDeploy</title>
    <link>http://sedodream.com/</link>
    <description>MSBuild, C#, Visual Studio and more</description>
    <language>en-us</language>
    <copyright>Sayed Ibrahim Hashimi</copyright>
    <lastBuildDate>Thu, 09 May 2013 05:33:20 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=19245c5f-8119-45bf-be6e-acc60ea53ed8</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,19245c5f-8119-45bf-be6e-acc60ea53ed8.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,19245c5f-8119-45bf-be6e-acc60ea53ed8.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=19245c5f-8119-45bf-be6e-acc60ea53ed8</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I’m happy to say that my <a href="http://www.amazon.com/gp/product/0735678162/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0735678162&amp;linkCode=as2&amp;tag=sedodream-20">Supplement
to Inside the Microsoft Build Engine</a> book (<em>co-author </em><a href="https://twitter.com/wbarthol"><em>William
Bartholomew</em></a>) has now been published. In fact it’s already in stock and ready
to be shipped by <a href="http://www.amazon.com/gp/product/0735678162/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0735678162&amp;linkCode=as2&amp;tag=sedodream-20">Amazon.com</a>. 
</p>
        <p>
This book is a small addition (<em>118 pages</em>) to the previous book, <a href="http://www.amazon.com/gp/product/0735645248/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0735645248&amp;linkCode=as2&amp;tag=sedodream-20">Inside
the Microsoft Build Engine 2nd edition</a>. It has a small price too, MSRP is $12.99
but it’s selling on Amazon.com for $8.99! In this book we cover the updates to MSBuild,
Team Build and Web Publishing in Visual Studio 2012. The foreword was written by <a href="http://www.hanselman.com/">Scott
Hanselman</a>, and you can <a href="http://blogs.msdn.com/b/microsoft_press/archive/2013/05/02/scott-hanselman-ah-the-thankless-life-of-the-build-master.aspx">read
the entire foreword online</a>. 
</p>
        <p>
Check out how thin the supplement is in comparison to the 2<sup>nd</sup> edition <em>#ThinIsIn</em>.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/Book-publ_137D2/945231_10103483509401051_968543011_n_2.jpg">
            <img title="945231_10103483509401051_968543011_n" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="945231_10103483509401051_968543011_n" src="http://sedodream.com/content/binary/Windows-Live-Writer/Book-publ_137D2/945231_10103483509401051_968543011_n_thumb.jpg" width="274" height="484" />
          </a>
        </p>
        <p>
 
</p>
        <p>
If you already own the 2<sup>nd</sup> edition then you’ll love this update.
</p>
        <p>
 
</p>
        <h3>Table of Contents
</h3>
        <p>
Chapter 1: What's new in MSBuild
</p>
        <ol>
          <li>
Visual Studio project compatibility between 2010 and 2012 
</li>
          <li>
Out of Process Tasks 
</li>
          <li>
NuGet 
</li>
          <li>
XML Updates with SlowCheetah 
</li>
          <li>
Cookbook</li>
        </ol>
        <h5>Chapter 2: What's new in Team Build 2012
</h5>
        <ol>
          <li>
Installation 
</li>
          <li>
Team Foundation Service 
</li>
          <li>
User interface (UI) enhancements 
</li>
          <li>
Visual Studio Test Runner 
</li>
          <li>
Pausing build definitions 
</li>
          <li>
Batching 
</li>
          <li>
Logging 
</li>
          <li>
Windows Workflow Foundation 4.5 
</li>
          <li>
Cookbook</li>
        </ol>
        <h5>Chapter 3: What's new in Web Publishing
</h5>
        <ol>
          <li>
Overview of the new Publish Web Dialog 
</li>
          <li>
Building web packages 
</li>
          <li>
Publish profiles 
</li>
          <li>
Database publishing support 
</li>
          <li>
Profile-specific web.config transforms 
</li>
          <li>
Cookbook</li>
        </ol>
        <p>
 
</p>
        <p>
The book has been available in e-book form for a few weeks. Just long enough for us
to get our first review. It was 5 stars :).
</p>
        <p>
          <a href="http://www.amazon.com/review/RVXCZ4FAXMVE5/?_encoding=UTF8&amp;ASIN=B00CDXOWJW&amp;camp=1789&amp;creative=390957&amp;linkCode=ur2&amp;nodeID=&amp;tag=sedodream-20">
            <img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/Book-publ_137D2/image_3.png" width="644" height="254" />
          </a>
        </p>
        <p>
 
</p>
        <p>
Please let us know what you think of this book! 
</p>
        <p>
 
</p>
        <p>
You can download all the samples and learn more at <a href="http://msbuildbook.com/">msbuildbook.com</a>.
</p>
        <p>
 
</p>
        <p>
Sayed Ibrahim Hashimi | <a href="http://msbuildbook.com">http://msbuildbook.com</a> | <a href="https://twitter.com/sayedihashimi">@SayedIHashimi</a></p>
      </body>
      <title>Book published and now in stock!</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,19245c5f-8119-45bf-be6e-acc60ea53ed8.aspx</guid>
      <link>http://sedodream.com/2013/05/09/BookPublishedAndNowInStock.aspx</link>
      <pubDate>Thu, 09 May 2013 05:33:20 GMT</pubDate>
      <description>&lt;p&gt;
I’m happy to say that my &lt;a href="http://www.amazon.com/gp/product/0735678162/ref=as_li_ss_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=0735678162&amp;amp;linkCode=as2&amp;amp;tag=sedodream-20"&gt;Supplement
to Inside the Microsoft Build Engine&lt;/a&gt; book (&lt;em&gt;co-author &lt;/em&gt;&lt;a href="https://twitter.com/wbarthol"&gt;&lt;em&gt;William
Bartholomew&lt;/em&gt;&lt;/a&gt;) has now been published. In fact it’s already in stock and ready
to be shipped by &lt;a href="http://www.amazon.com/gp/product/0735678162/ref=as_li_ss_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=0735678162&amp;amp;linkCode=as2&amp;amp;tag=sedodream-20"&gt;Amazon.com&lt;/a&gt;. 
&lt;/p&gt;
&lt;p&gt;
This book is a small addition (&lt;em&gt;118 pages&lt;/em&gt;) to the previous book, &lt;a href="http://www.amazon.com/gp/product/0735645248/ref=as_li_ss_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=0735645248&amp;amp;linkCode=as2&amp;amp;tag=sedodream-20"&gt;Inside
the Microsoft Build Engine 2nd edition&lt;/a&gt;. It has a small price too, MSRP is $12.99
but it’s selling on Amazon.com for $8.99! In this book we cover the updates to MSBuild,
Team Build and Web Publishing in Visual Studio 2012. The foreword was written by &lt;a href="http://www.hanselman.com/"&gt;Scott
Hanselman&lt;/a&gt;, and you can &lt;a href="http://blogs.msdn.com/b/microsoft_press/archive/2013/05/02/scott-hanselman-ah-the-thankless-life-of-the-build-master.aspx"&gt;read
the entire foreword online&lt;/a&gt;. 
&lt;/p&gt;
&lt;p&gt;
Check out how thin the supplement is in comparison to the 2&lt;sup&gt;nd&lt;/sup&gt; edition &lt;em&gt;#ThinIsIn&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/Book-publ_137D2/945231_10103483509401051_968543011_n_2.jpg"&gt;&lt;img title="945231_10103483509401051_968543011_n" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="945231_10103483509401051_968543011_n" src="http://sedodream.com/content/binary/Windows-Live-Writer/Book-publ_137D2/945231_10103483509401051_968543011_n_thumb.jpg" width="274" height="484"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
If you already own the 2&lt;sup&gt;nd&lt;/sup&gt; edition then you’ll love this update.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;h3&gt;Table of Contents
&lt;/h3&gt;
&lt;p&gt;
Chapter 1: What's new in MSBuild
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Visual Studio project compatibility between 2010 and 2012 
&lt;li&gt;
Out of Process Tasks 
&lt;li&gt;
NuGet 
&lt;li&gt;
XML Updates with SlowCheetah 
&lt;li&gt;
Cookbook&lt;/li&gt;
&lt;/ol&gt;
&lt;h5&gt;Chapter 2: What's new in Team Build 2012
&lt;/h5&gt;
&lt;ol&gt;
&lt;li&gt;
Installation 
&lt;li&gt;
Team Foundation Service 
&lt;li&gt;
User interface (UI) enhancements 
&lt;li&gt;
Visual Studio Test Runner 
&lt;li&gt;
Pausing build definitions 
&lt;li&gt;
Batching 
&lt;li&gt;
Logging 
&lt;li&gt;
Windows Workflow Foundation 4.5 
&lt;li&gt;
Cookbook&lt;/li&gt;
&lt;/ol&gt;
&lt;h5&gt;Chapter 3: What's new in Web Publishing
&lt;/h5&gt;
&lt;ol&gt;
&lt;li&gt;
Overview of the new Publish Web Dialog 
&lt;li&gt;
Building web packages 
&lt;li&gt;
Publish profiles 
&lt;li&gt;
Database publishing support 
&lt;li&gt;
Profile-specific web.config transforms 
&lt;li&gt;
Cookbook&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
The book has been available in e-book form for a few weeks. Just long enough for us
to get our first review. It was 5 stars :).
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.amazon.com/review/RVXCZ4FAXMVE5/?_encoding=UTF8&amp;amp;ASIN=B00CDXOWJW&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;linkCode=ur2&amp;amp;nodeID=&amp;amp;tag=sedodream-20"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/Book-publ_137D2/image_3.png" width="644" height="254"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Please let us know what you think of this book! 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
You can download all the samples and learn more at &lt;a href="http://msbuildbook.com/"&gt;msbuildbook.com&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi | &lt;a href="http://msbuildbook.com"&gt;http://msbuildbook.com&lt;/a&gt; | &lt;a href="https://twitter.com/sayedihashimi"&gt;@SayedIHashimi&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,19245c5f-8119-45bf-be6e-acc60ea53ed8.aspx</comments>
      <category>MSBuild</category>
      <category>MSDeploy</category>
      <category>Team Build</category>
      <category>web</category>
      <category>Web Publishing Pipeline</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=7d187729-cc9c-4654-8d15-a4bc4372f91d</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,7d187729-cc9c-4654-8d15-a4bc4372f91d.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,7d187729-cc9c-4654-8d15-a4bc4372f91d.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=7d187729-cc9c-4654-8d15-a4bc4372f91d</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Today on twitter <a href="https://twitter.com/nunofcosta">@nunofcosta</a> asked me
roughly the question “<em>How do I publish one web project from a solution that contains
many?</em>”
</p>
        <p>
The issue that he is running into is that he is building from the command line and
passing the following properties to msbuild.exe.
</p>
        <pre class="brush: xml;">    /p:DeployOnBuild=true
    /p:PublishProfile='siteone - Web Deploy'
    /p:Password=%password%
</pre>
        <p>
You can read more about how to automate publishing at <a title="http://sedodream.com/2013/01/06/CommandLineWebProjectPublishing.aspx" href="http://sedodream.com/2013/01/06/CommandLineWebProjectPublishing.aspx">http://sedodream.com/2013/01/06/CommandLineWebProjectPublishing.aspx</a>.
</p>
        <p>
When you pass these properties to msbuild.exe they are known as global properties.
These properties are difficult to override and are passed to every project that is
built. Because of this if you have a solution with multiple web projects, when each
web project is built it is passed in the same set of properties. Because of this when
each project is built the publish process for that project will start and it will
expect to find a file named <strong>siteone – Web Deploy.pubxml</strong> in the folder
Properties\PublishProfiles\. If the file doesn’t exist the operation may fail.
</p>
        <blockquote>
          <p>
            <em>Note: If you are interested in using this technique for an orchestrated publish
see my comments at </em>
            <a title="http://stackoverflow.com/a/14231729/105999" href="http://stackoverflow.com/a/14231729/105999">
              <em>http://stackoverflow.com/a/14231729/105999</em>
            </a>
            <em> before
doing so.</em>
          </p>
        </blockquote>
        <p>
So how can we resolve this? 
</p>
        <p>
Let’s take a look at a sample (see links below). I have a solution, <strong>PublishOnlyOne</strong>,
with the following projects.
</p>
        <ol>
          <li>
ProjA 
</li>
          <li>
ProjB</li>
        </ol>
        <p>
ProjA has a publish profile named ‘<strong>siteone – Web Deploy</strong>’, ProjB does
not. When trying to publish this you may try the following command line.
</p>
        <pre class="brush: xml;">    msbuild.exe PublishOnlyOne.sln /p:DeployOnBuild=true /p:PublishProfile=’siteone – Web Deploy’ /p:Password=%password%
</pre>
        <p>
          <em>See publish-sln.cmd in the samples.</em>
        </p>
        <p>
If you do this, when its time for ProjB to build it will fail because there’s no <strong>siteone
– Web Deploy</strong> profile for that project. Because of this, we cannot pass DeployOnBuild.
Instead here is what we need to do.
</p>
        <ol>
          <li>
Edit ProjA.csproj to define another property which will conditionally set DeployOnBuild 
</li>
          <li>
From the command line pass in that property</li>
        </ol>
        <p>
 
</p>
        <p>
I edited ProjA and added the following property group before the Import statements
in the .csproj file.
</p>
        <pre class="brush: xml;">&lt;PropertyGroup&gt;
  &lt;DeployOnBuild Condition=" '$(DeployProjA)'!='' "&gt;$(DeployProjA)&lt;/DeployOnBuild&gt;
&lt;/PropertyGroup&gt;
</pre>
        <p>
 
</p>
        <p>
Here you can see that DeployOnBuild is set to whatever value DeployProjA is as long
as it’s not empty. Now the revised command is:
</p>
        <pre class="brush: xml;">    msbuild.exe PublishOnlyOne.sln /p:DeployProjA=true /p:PublishProfile=’siteone – Web Deploy’ /p:Password=%password%
</pre>
        <p>
Here instead of passing DeployOnBuild, I pass in DeployProjA which will then set DeployOnBuild.
Since DeployOnBuild wasn’t passed to ProjB it will not attempt to publish.
</p>
        <p>
 
</p>
        <p>
You can find the complete sample at <a title="https://github.com/sayedihashimi/sayed-samples/tree/master/PublishOnlyOne" href="https://github.com/sayedihashimi/sayed-samples/tree/master/PublishOnlyOne">https://github.com/sayedihashimi/sayed-samples/tree/master/PublishOnlyOne</a>. 
</p>
        <p>
 
</p>
        <p>
Sayed Ibrahim Hashimi | <a href="https://twitter.com/sayedihashimi">@SayedIHashimi</a> | <a href="http://msbuildbook.com/">http://msbuildbook.com/</a></p>
      </body>
      <title>How to publish one web project from a solution</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,7d187729-cc9c-4654-8d15-a4bc4372f91d.aspx</guid>
      <link>http://sedodream.com/2013/03/06/HowToPublishOneWebProjectFromASolution.aspx</link>
      <pubDate>Wed, 06 Mar 2013 02:48:41 GMT</pubDate>
      <description>&lt;p&gt;
Today on twitter &lt;a href="https://twitter.com/nunofcosta"&gt;@nunofcosta&lt;/a&gt; asked me
roughly the question “&lt;em&gt;How do I publish one web project from a solution that contains
many?&lt;/em&gt;”
&lt;/p&gt;
&lt;p&gt;
The issue that he is running into is that he is building from the command line and
passing the following properties to msbuild.exe.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;    /p:DeployOnBuild=true
    /p:PublishProfile='siteone - Web Deploy'
    /p:Password=%password%
&lt;/pre&gt;
&lt;p&gt;
You can read more about how to automate publishing at &lt;a title="http://sedodream.com/2013/01/06/CommandLineWebProjectPublishing.aspx" href="http://sedodream.com/2013/01/06/CommandLineWebProjectPublishing.aspx"&gt;http://sedodream.com/2013/01/06/CommandLineWebProjectPublishing.aspx&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
When you pass these properties to msbuild.exe they are known as global properties.
These properties are difficult to override and are passed to every project that is
built. Because of this if you have a solution with multiple web projects, when each
web project is built it is passed in the same set of properties. Because of this when
each project is built the publish process for that project will start and it will
expect to find a file named &lt;strong&gt;siteone – Web Deploy.pubxml&lt;/strong&gt; in the folder
Properties\PublishProfiles\. If the file doesn’t exist the operation may fail.
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;em&gt;Note: If you are interested in using this technique for an orchestrated publish
see my comments at &lt;/em&gt;&lt;a title="http://stackoverflow.com/a/14231729/105999" href="http://stackoverflow.com/a/14231729/105999"&gt;&lt;em&gt;http://stackoverflow.com/a/14231729/105999&lt;/em&gt;&lt;/a&gt;&lt;em&gt; before
doing so.&lt;/em&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
So how can we resolve this? 
&lt;/p&gt;
&lt;p&gt;
Let’s take a look at a sample (see links below). I have a solution, &lt;strong&gt;PublishOnlyOne&lt;/strong&gt;,
with the following projects.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
ProjA 
&lt;li&gt;
ProjB&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
ProjA has a publish profile named ‘&lt;strong&gt;siteone – Web Deploy&lt;/strong&gt;’, ProjB does
not. When trying to publish this you may try the following command line.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;    msbuild.exe PublishOnlyOne.sln /p:DeployOnBuild=true /p:PublishProfile=’siteone – Web Deploy’ /p:Password=%password%
&lt;/pre&gt;
&lt;p&gt;
&lt;em&gt;See publish-sln.cmd in the samples.&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
If you do this, when its time for ProjB to build it will fail because there’s no &lt;strong&gt;siteone
– Web Deploy&lt;/strong&gt; profile for that project. Because of this, we cannot pass DeployOnBuild.
Instead here is what we need to do.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Edit ProjA.csproj to define another property which will conditionally set DeployOnBuild 
&lt;li&gt;
From the command line pass in that property&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
I edited ProjA and added the following property group before the Import statements
in the .csproj file.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;PropertyGroup&amp;gt;
  &amp;lt;DeployOnBuild Condition=" '$(DeployProjA)'!='' "&amp;gt;$(DeployProjA)&amp;lt;/DeployOnBuild&amp;gt;
&amp;lt;/PropertyGroup&amp;gt;
&lt;/pre&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Here you can see that DeployOnBuild is set to whatever value DeployProjA is as long
as it’s not empty. Now the revised command is:
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;    msbuild.exe PublishOnlyOne.sln /p:DeployProjA=true /p:PublishProfile=’siteone – Web Deploy’ /p:Password=%password%
&lt;/pre&gt;
&lt;p&gt;
Here instead of passing DeployOnBuild, I pass in DeployProjA which will then set DeployOnBuild.
Since DeployOnBuild wasn’t passed to ProjB it will not attempt to publish.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
You can find the complete sample at &lt;a title="https://github.com/sayedihashimi/sayed-samples/tree/master/PublishOnlyOne" href="https://github.com/sayedihashimi/sayed-samples/tree/master/PublishOnlyOne"&gt;https://github.com/sayedihashimi/sayed-samples/tree/master/PublishOnlyOne&lt;/a&gt;. 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi | &lt;a href="https://twitter.com/sayedihashimi"&gt;@SayedIHashimi&lt;/a&gt; | &lt;a href="http://msbuildbook.com/"&gt;http://msbuildbook.com/&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,7d187729-cc9c-4654-8d15-a4bc4372f91d.aspx</comments>
      <category>MSDeploy</category>
      <category>web</category>
      <category>Web Deployment Tool</category>
      <category>Web Development</category>
      <category>Web Publishing Pipeline</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=0ead210a-209b-4f45-9fac-3c55162b2e53</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,0ead210a-209b-4f45-9fac-3c55162b2e53.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,0ead210a-209b-4f45-9fac-3c55162b2e53.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=0ead210a-209b-4f45-9fac-3c55162b2e53</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
With the release of VS2012 we have improved the command line publish experience. We’ve
also made all the web publish related features available for VS2010 users in the <a href="http://www.windowsazure.com/en-us/develop/net/">Azure
SDK</a>.
</p>
        <p>
The easies way to publish a project from the command line is to create a publish profile
in VS and then use that. To create a publish profile in Visual Studio right click
on the web project and select Publish. After that it will walk you though creating
a publish profile. VS Web publish profile support the following publish methods.
</p>
        <ul>
          <li>
            <strong>Web Deploy</strong> – The preferred method. You can publish to any host/server
which has <a href="http://www.iis.net/downloads/microsoft/web-deploy">Web Deploy</a> configured 
</li>
          <li>
            <strong>Web Deploy Package</strong>  - Used to create a package which can be
published offline at a later time 
</li>
          <li>
            <strong>File system</strong>  - Used to publish to a local/network folder 
</li>
          <li>
            <strong>FTP</strong>  - Used to publish to any FTP server 
</li>
          <li>
            <strong>FPSE</strong> – Used to publish to a server using Front Page Server Extensions</li>
        </ul>
        <p>
Command line publishing is only supported for Web Deploy, Web Deploy Package, and
File System. If you think we should support command line scenarios for other publish
methods the best thing to do would be to create a suggestion at <a title="http://aspnet.uservoice.com" href="http://aspnet.uservoice.com">http://aspnet.uservoice.com</a>.
If there is enough interest we may work on that support.
</p>
        <p>
Let’s first take a look at how you can publish a simple Web project from the command
line. I have created a simple Web Forms project and want to publish that. I’ve created
a profile named SayedProfile. In order to publish this project I will execute the
following command.
</p>
        <p>
msbuild MyProject.csproj /p:DeployOnBuild=true /p:PublishProfile=&lt;profile-name&gt;
/p:Password=&lt;insert-password&gt; /p:VisualStudioVersion=11.0
</p>
        <p>
In this command you can see that I have passed in these properties; 
</p>
        <ul>
          <li>
            <strong>DeployOnBuild</strong> – when true the build process will be extended to perform
a publish as well 
</li>
          <li>
            <strong>PublishProfile</strong>  - name of the publish profile (<em>you can also
provide a full path to a .pubxml file</em>) 
</li>
          <li>
            <strong>Password</strong> – Password value 
</li>
          <li>
            <strong>VisualStudioVersion</strong> – Special property see comments below</li>
        </ul>
        <p>
You may not have expected the VisualStudioVersion property here. This is a new property
which was introduced with VS 2012. It is related to how VS 2010 and VS 2012 are able
to share the same projects. Take a look at my previous blog post at <a title="http://sedodream.com/2012/08/19/VisualStudioProjectCompatabilityAndVisualStudioVersion.aspx" href="http://sedodream.com/2012/08/19/VisualStudioProjectCompatabilityAndVisualStudioVersion.aspx">http://sedodream.com/2012/08/19/VisualStudioProjectCompatabilityAndVisualStudioVersion.aspx</a>. <strong><u>If
you are building the project file, instead of the solution file then you should always
set this property.</u></strong></p>
        <p>
If you are publishing using the .sln file you can omit the VisualStudioVersion property.
That property will be derived from the version of the solution file itself. Note that
there is one big difference when publishing using the project or solution file. When
you build an individual project the properties you pass in are given to that project
alone. When you build from the command line using the solution file, the properties
you have specified are passed to all the projects. So if you have multiple web projects
in the same solution it would attempt to publish each of the web projects.
</p>
        <p>
FYI in case you haven’t already heard I’m working on an update to my book. More info
at <a href="msbuildbook.com">msbuildbook.com</a></p>
        <p>
Sayed Ibrahim Hashimi | <a href="https://twitter.com/sayedihashimi">@SayedIHashimi</a></p>
      </body>
      <title>Command line web project publishing</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,0ead210a-209b-4f45-9fac-3c55162b2e53.aspx</guid>
      <link>http://sedodream.com/2013/01/06/CommandLineWebProjectPublishing.aspx</link>
      <pubDate>Sun, 06 Jan 2013 02:56:37 GMT</pubDate>
      <description>&lt;p&gt;
With the release of VS2012 we have improved the command line publish experience. We’ve
also made all the web publish related features available for VS2010 users in the &lt;a href="http://www.windowsazure.com/en-us/develop/net/"&gt;Azure
SDK&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
The easies way to publish a project from the command line is to create a publish profile
in VS and then use that. To create a publish profile in Visual Studio right click
on the web project and select Publish. After that it will walk you though creating
a publish profile. VS Web publish profile support the following publish methods.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Web Deploy&lt;/strong&gt; – The preferred method. You can publish to any host/server
which has &lt;a href="http://www.iis.net/downloads/microsoft/web-deploy"&gt;Web Deploy&lt;/a&gt; configured 
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Web Deploy Package&lt;/strong&gt;&amp;#160; - Used to create a package which can be
published offline at a later time 
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;File system&lt;/strong&gt;&amp;#160; - Used to publish to a local/network folder 
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FTP&lt;/strong&gt;&amp;#160; - Used to publish to any FTP server 
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FPSE&lt;/strong&gt; – Used to publish to a server using Front Page Server Extensions&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Command line publishing is only supported for Web Deploy, Web Deploy Package, and
File System. If you think we should support command line scenarios for other publish
methods the best thing to do would be to create a suggestion at &lt;a title="http://aspnet.uservoice.com" href="http://aspnet.uservoice.com"&gt;http://aspnet.uservoice.com&lt;/a&gt;.
If there is enough interest we may work on that support.
&lt;/p&gt;
&lt;p&gt;
Let’s first take a look at how you can publish a simple Web project from the command
line. I have created a simple Web Forms project and want to publish that. I’ve created
a profile named SayedProfile. In order to publish this project I will execute the
following command.
&lt;/p&gt;
&lt;p&gt;
msbuild MyProject.csproj /p:DeployOnBuild=true /p:PublishProfile=&amp;lt;profile-name&amp;gt;
/p:Password=&amp;lt;insert-password&amp;gt; /p:VisualStudioVersion=11.0
&lt;/p&gt;
&lt;p&gt;
In this command you can see that I have passed in these properties; 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;DeployOnBuild&lt;/strong&gt; – when true the build process will be extended to perform
a publish as well 
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PublishProfile&lt;/strong&gt;&amp;#160; - name of the publish profile (&lt;em&gt;you can also
provide a full path to a .pubxml file&lt;/em&gt;) 
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Password&lt;/strong&gt; – Password value 
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VisualStudioVersion&lt;/strong&gt; – Special property see comments below&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
You may not have expected the VisualStudioVersion property here. This is a new property
which was introduced with VS 2012. It is related to how VS 2010 and VS 2012 are able
to share the same projects. Take a look at my previous blog post at &lt;a title="http://sedodream.com/2012/08/19/VisualStudioProjectCompatabilityAndVisualStudioVersion.aspx" href="http://sedodream.com/2012/08/19/VisualStudioProjectCompatabilityAndVisualStudioVersion.aspx"&gt;http://sedodream.com/2012/08/19/VisualStudioProjectCompatabilityAndVisualStudioVersion.aspx&lt;/a&gt;. &lt;strong&gt;&lt;u&gt;If
you are building the project file, instead of the solution file then you should always
set this property.&lt;/u&gt;&lt;/strong&gt; 
&lt;/p&gt;
&lt;p&gt;
If you are publishing using the .sln file you can omit the VisualStudioVersion property.
That property will be derived from the version of the solution file itself. Note that
there is one big difference when publishing using the project or solution file. When
you build an individual project the properties you pass in are given to that project
alone. When you build from the command line using the solution file, the properties
you have specified are passed to all the projects. So if you have multiple web projects
in the same solution it would attempt to publish each of the web projects.
&lt;/p&gt;
&lt;p&gt;
FYI in case you haven’t already heard I’m working on an update to my book. More info
at &lt;a href="msbuildbook.com"&gt;msbuildbook.com&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;</description>
      <comments>http://sedodream.com/CommentView,guid,0ead210a-209b-4f45-9fac-3c55162b2e53.aspx</comments>
      <category>MSBuild</category>
      <category>MSBuild 4.0</category>
      <category>MSDeploy</category>
      <category>web</category>
      <category>Web Deployment Tool</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=ee956b11-d7cc-427f-8e79-56ca2437e346</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,ee956b11-d7cc-427f-8e79-56ca2437e346.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,ee956b11-d7cc-427f-8e79-56ca2437e346.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=ee956b11-d7cc-427f-8e79-56ca2437e346</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I received a customer email and one of the things that he wants to be able to do is
sync multiple folders. I thought I’d share with you what I wrote to him.
</p>
        <p>
          <b>From:</b> Sayed Hashimi 
<br /><b>Sent:</b> Tuesday, December 18, 2012 11:28 PM 
<br /></p>
        <p>
You actually can do this, but it’s not based on skips, it’s an opt-in approach. What
I mean is that you would have to specify all the folders that you wanted to sync.
</p>
        <p>
MSDeploy is a provider based model. There is an composite provider, manifest, which
can be used when multiple providers are required. In your case the actual provider
that you want to use is contentPath. This is the provider that knows how to sync folders.
If you want to sync multiple folders you can create a source manifest which has the
source folders and a dest manifest which has all the target folders.
</p>
        <p>
In my example I have the following folders.
</p>
        <ul>
          <li>
c:\temp\publish\souce\01</li>
          <li>
c:\temp\publish\souce\02</li>
          <li>
c:\temp\publish\souce\03</li>
        </ul>
        <p>
I only want to sync 01 and 03 so I create the manifest with the following content.
</p>
        <pre class="brush: xml;">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;sitemanifest&gt;
  &lt;contentPath path="C:\Temp\publish\Source\01"/&gt;
  &lt;contentPath path="C:\Temp\publish\Source\03"/&gt;
&lt;/sitemanifest&gt;</pre>
        <p>
The dest manifest file will contain.
</p>
        <pre class="brush: xml;">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;sitemanifest&gt;
  &lt;contentPath path="C:\Temp\publish\Dest\01"/&gt;
  &lt;contentPath path="C:\Temp\publish\Dest\03"/&gt;
&lt;/sitemanifest&gt;</pre>
        <p>
Then to do the sync you can use the command.
</p>
        <pre class="brush: xml;">msdeploy -verb:sync -source:manifest="C:\Temp\publish\SourceManifest.xml" -dest:manifest="C:\Temp\publish\DestManifest.xml" -enableRule:DoNotDelete -useCheckSum -disableRule:BackupRule</pre>
        <p>
You can see that I use the manifest provider for both the source and the dest. A few
things to note.
</p>
        <ul>
          <li>
-enableRule:DoNotDelete - Pass this to ensure that other content in the dest is not
deleted</li>
          <li>
-useCheckSum – Pass this to ensure that only the minimal set of files is synced</li>
          <li>
-disableRule:BackupRule – When using MSDeploy v3 I was getting errors relating to
the auto backup feature, just pass this to avoid that (<i>this could be an issue with
my machine setup</i>)</li>
        </ul>
        <p>
          <b>
            <u>Drawbacks from this approach</u>
          </b>
        </p>
        <ul>
          <li>
You must use full paths in the source/dest manifests.</li>
          <li>
Your source/dest manifests must have matching contentPath elements</li>
          <li>
This approach requires two files; source manifest &amp; dest manifest</li>
        </ul>
        <p>
          <b>
            <u>How you can make this even better</u>
          </b>
        </p>
        <p>
The real issue I have with this approach is that it requires both a source &amp; dest
manifest. If you can easily auto generate these files from a list of shares that would
be great. If you are maintaining these files “by hand” you should be careful to make
sure both files are updated.
</p>
        <p>
With a bit of more work you can boil it down to a single source manifest if you have
a common root folder, and you want the files to be reflected in the same relative
structure underneath that. They way that you would do this is to use the MSDeploy
auto provider trick. With MSDeploy you can pass –dest:auto and MSDeploy will essentially
reflect the source settings to the destination. You can then create an MSDeploy parameter
which will be used to update the path of that common root folder.
</p>
        <p>
If you want to go down this option it will be a bit more complex. I’d be willing to
walk you through it if you’d be willing to blog about it afterwards J
</p>
        <p>
Thanks, 
<br />
Sayed Ibrahim Hashimi | <a href="https://twitter.com/sayedihashimi" target="_blank">@SayedIHashimi</a></p>
      </body>
      <title>How to sync multiple folders with Web Deploy (MSDeploy)</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,ee956b11-d7cc-427f-8e79-56ca2437e346.aspx</guid>
      <link>http://sedodream.com/2012/12/19/HowToSyncMultipleFoldersWithWebDeployMSDeploy.aspx</link>
      <pubDate>Wed, 19 Dec 2012 07:34:19 GMT</pubDate>
      <description>&lt;p&gt;
I received a customer email and one of the things that he wants to be able to do is
sync multiple folders. I thought I’d share with you what I wrote to him.
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;From:&lt;/b&gt; Sayed Hashimi 
&lt;br /&gt;
&lt;b&gt;Sent:&lt;/b&gt; Tuesday, December 18, 2012 11:28 PM 
&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;
You actually can do this, but it’s not based on skips, it’s an opt-in approach. What
I mean is that you would have to specify all the folders that you wanted to sync.
&lt;/p&gt;
&lt;p&gt;
MSDeploy is a provider based model. There is an composite provider, manifest, which
can be used when multiple providers are required. In your case the actual provider
that you want to use is contentPath. This is the provider that knows how to sync folders.
If you want to sync multiple folders you can create a source manifest which has the
source folders and a dest manifest which has all the target folders.
&lt;/p&gt;
&lt;p&gt;
In my example I have the following folders.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
c:\temp\publish\souce\01&lt;/li&gt;
&lt;li&gt;
c:\temp\publish\souce\02&lt;/li&gt;
&lt;li&gt;
c:\temp\publish\souce\03&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
I only want to sync 01 and 03 so I create the manifest with the following content.
&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;sitemanifest&amp;gt;
  &amp;lt;contentPath path=&amp;quot;C:\Temp\publish\Source\01&amp;quot;/&amp;gt;
  &amp;lt;contentPath path=&amp;quot;C:\Temp\publish\Source\03&amp;quot;/&amp;gt;
&amp;lt;/sitemanifest&amp;gt;&lt;/pre&gt;
&lt;p&gt;
The dest manifest file will contain.
&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;sitemanifest&amp;gt;
  &amp;lt;contentPath path=&amp;quot;C:\Temp\publish\Dest\01&amp;quot;/&amp;gt;
  &amp;lt;contentPath path=&amp;quot;C:\Temp\publish\Dest\03&amp;quot;/&amp;gt;
&amp;lt;/sitemanifest&amp;gt;&lt;/pre&gt;
&lt;p&gt;
Then to do the sync you can use the command.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;msdeploy -verb:sync -source:manifest=&amp;quot;C:\Temp\publish\SourceManifest.xml&amp;quot; -dest:manifest=&amp;quot;C:\Temp\publish\DestManifest.xml&amp;quot; -enableRule:DoNotDelete -useCheckSum -disableRule:BackupRule&lt;/pre&gt;
&lt;p&gt;
You can see that I use the manifest provider for both the source and the dest. A few
things to note.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
-enableRule:DoNotDelete - Pass this to ensure that other content in the dest is not
deleted&lt;/li&gt;
&lt;li&gt;
-useCheckSum – Pass this to ensure that only the minimal set of files is synced&lt;/li&gt;
&lt;li&gt;
-disableRule:BackupRule – When using MSDeploy v3 I was getting errors relating to
the auto backup feature, just pass this to avoid that (&lt;i&gt;this could be an issue with
my machine setup&lt;/i&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;b&gt;&lt;u&gt;Drawbacks from this approach&lt;/u&gt;&lt;/b&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
You must use full paths in the source/dest manifests.&lt;/li&gt;
&lt;li&gt;
Your source/dest manifests must have matching contentPath elements&lt;/li&gt;
&lt;li&gt;
This approach requires two files; source manifest &amp;amp; dest manifest&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;b&gt;&lt;u&gt;How you can make this even better&lt;/u&gt;&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
The real issue I have with this approach is that it requires both a source &amp;amp; dest
manifest. If you can easily auto generate these files from a list of shares that would
be great. If you are maintaining these files “by hand” you should be careful to make
sure both files are updated.
&lt;/p&gt;
&lt;p&gt;
With a bit of more work you can boil it down to a single source manifest if you have
a common root folder, and you want the files to be reflected in the same relative
structure underneath that. They way that you would do this is to use the MSDeploy
auto provider trick. With MSDeploy you can pass –dest:auto and MSDeploy will essentially
reflect the source settings to the destination. You can then create an MSDeploy parameter
which will be used to update the path of that common root folder.
&lt;/p&gt;
&lt;p&gt;
If you want to go down this option it will be a bit more complex. I’d be willing to
walk you through it if you’d be willing to blog about it afterwards J
&lt;/p&gt;
&lt;p&gt;
Thanks, 
&lt;br /&gt;
Sayed Ibrahim Hashimi | &lt;a href="https://twitter.com/sayedihashimi" target="_blank"&gt;@SayedIHashimi&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,ee956b11-d7cc-427f-8e79-56ca2437e346.aspx</comments>
      <category>MSDeploy</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=ca9825b2-a384-4d68-9413-e774948bbd58</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,ca9825b2-a384-4d68-9413-e774948bbd58.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,ca9825b2-a384-4d68-9413-e774948bbd58.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=ca9825b2-a384-4d68-9413-e774948bbd58</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
When you are building a .sln file or a .csproj/.vbproj/etc you need to be careful
how you set the Configuration property. Once this property is set you do not want
to change the value of it. Because of this it is best to specify this as a global
property. To do that you can pass it in on the command line. If you are using the <a href="http://msdn.microsoft.com/en-us/library/z7f65y0d.aspx" target="_blank">MSBuild
task</a> then you can pass it in via Properties or AdditionalProperties. <strong>What
you do not want to do is to set this value inside your .csproj/.vbproj or any imported
file.</strong> The only time when this is OK if there is a condition which will not
set the property if it’s already been set. This is exactly how the default .csproj/.vbproj
files are authored:
</p>
        <pre class="brush: xml;">&lt;Configuration Condition=" '$(Configuration)' == '' "&gt;Debug&lt;/Configuration&gt;</pre>
        <p>
If you do set this property w/o the conditional not to overwrite an existing value
you may experience really strange behavior during your builds. And it may be difficult
to diagnose the issue as well.
</p>
        <p>
Now let me explain why you cannot do this. When you build a .csproj/.vbproj MSBuild
will start creating an in-memory representation of the entire project. It will start
with the .csproj/.vbproj file itself. It will read the file from top to bottom. When
a property is encountered it is evaluated. If a property is encountered that relies
on another one, for example
</p>
        <pre class="brush: xml;">&lt;IntermediateOutputPath Condition=" '$(PlatformName)' == 'AnyCPU' "&gt;$(BaseIntermediateOutputPath)$(Configuration)\&lt;/IntermediateOutputPath&gt;</pre>
        <p>
The properties inside the expression will be evaluated on whatever values exist for
the properties at the time. In this case ItermediateOutputPath will be the value of
BaseIntermediateOutputPath and Configuration.
</p>
        <p>
If a property is encountered which specifies a value for a property which has been
previously declared, the previous value will be discarded.
</p>
        <p>
The implications of this are subtle but very simple; <strong>once a property has been
set which has dependent properties you must not overwrite that property</strong>.
This is because when a dependent property is encountered it is evaluated immediately.
You cannot re-evaluate that property. So if you set a property during your build,
some existing dependent properties which were evaluated before the value change will
continue to use the old value. There is no way to re-evaluate those properties.
</p>
        <p>
Now lets see how this relates to the Configuration property specifically.
</p>
        <p>
The contents of the .csproj/.vbproj are properties/items along with an import to Microsoft.csharp.targets
(Microsoft.VisualBasic.targets for .vbproj) which then imports Microsoft.Common.targets.
If you look in Microsoft.common.targets you will see many different properties which
are declared using $(Configuration). So this means that you must treat the Configuration
property with care and abide by the rule that I have outlined above.
</p>
        <p>
FYI If you want more details on this I have explained this entire process in great
detail in my book <a href="http://www.amazon.com/gp/product/0735645248?ie=UTF8&amp;tag=sedodream-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0735645248" target="_blank">Inside
MSBuild and Team Build</a>.
</p>
        <p>
          <strong>
            <u>Configuration for web publishing</u>
          </strong>
        </p>
        <p>
If you have used the new web publish experience in Visual Studio 2012 (also available
for VS2010 from the <a href="https://www.windowsazure.com/en-us/develop/net/#" target="_blank">Azure
SDK</a>) you may have noticed that the web publish profiles are MSBuild files. They
are stored under Properties\PublishProfiles (My Project\PublishProfiles for VB) and
have extensions of .pubxml. In that file (or in a .pubxml.user file associated with
it) you will find a property defined as
</p>
        <pre class="brush: xml;">&lt;LastUsedBuildConfiguration&gt;Release&lt;/LastUsedBulidConfiguration&gt;</pre>
        <p>
This value corresponds to the value for the Configuration drop down in the VS web
publish dialog. When you kick off a publish in VS we use this value and kick off a
build and specify Configuration as a global property which is passed in. The reason
why we did not name this property Configuration is because the web publish profile
is imported into the web project itself during the publish process. By the file being
imported you can natively access all the properties/items of the .csproj/.vbproj and
also easily extend the build process. Since that is the case we cannot set the Configuration
property because we know it’s value has already been set. Due to this when publishing
from the command line you must specify the Configuration property.
</p>
        <p>
Sayed Ibrahim Hashimi | <a href="http://twitter.com/sayedihashimi" target="_blank">@SayedIHashimi</a></p>
      </body>
      <title>MSBuild: how to set the configuration property</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,ca9825b2-a384-4d68-9413-e774948bbd58.aspx</guid>
      <link>http://sedodream.com/2012/10/27/MSBuildHowToSetTheConfigurationProperty.aspx</link>
      <pubDate>Sat, 27 Oct 2012 02:49:02 GMT</pubDate>
      <description>&lt;p&gt;
When you are building a .sln file or a .csproj/.vbproj/etc you need to be careful
how you set the Configuration property. Once this property is set you do not want
to change the value of it. Because of this it is best to specify this as a global
property. To do that you can pass it in on the command line. If you are using the &lt;a href="http://msdn.microsoft.com/en-us/library/z7f65y0d.aspx" target="_blank"&gt;MSBuild
task&lt;/a&gt; then you can pass it in via Properties or AdditionalProperties. &lt;strong&gt;What
you do not want to do is to set this value inside your .csproj/.vbproj or any imported
file.&lt;/strong&gt; The only time when this is OK if there is a condition which will not
set the property if it’s already been set. This is exactly how the default .csproj/.vbproj
files are authored:
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;Configuration Condition=&amp;quot; '$(Configuration)' == '' &amp;quot;&amp;gt;Debug&amp;lt;/Configuration&amp;gt;&lt;/pre&gt;
&lt;p&gt;
If you do set this property w/o the conditional not to overwrite an existing value
you may experience really strange behavior during your builds. And it may be difficult
to diagnose the issue as well.
&lt;/p&gt;
&lt;p&gt;
Now let me explain why you cannot do this. When you build a .csproj/.vbproj MSBuild
will start creating an in-memory representation of the entire project. It will start
with the .csproj/.vbproj file itself. It will read the file from top to bottom. When
a property is encountered it is evaluated. If a property is encountered that relies
on another one, for example
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;IntermediateOutputPath Condition=&amp;quot; '$(PlatformName)' == 'AnyCPU' &amp;quot;&amp;gt;$(BaseIntermediateOutputPath)$(Configuration)\&amp;lt;/IntermediateOutputPath&amp;gt;&lt;/pre&gt;
&lt;p&gt;
The properties inside the expression will be evaluated on whatever values exist for
the properties at the time. In this case ItermediateOutputPath will be the value of
BaseIntermediateOutputPath and Configuration.
&lt;/p&gt;
&lt;p&gt;
If a property is encountered which specifies a value for a property which has been
previously declared, the previous value will be discarded.
&lt;/p&gt;
&lt;p&gt;
The implications of this are subtle but very simple; &lt;strong&gt;once a property has been
set which has dependent properties you must not overwrite that property&lt;/strong&gt;.
This is because when a dependent property is encountered it is evaluated immediately.
You cannot re-evaluate that property. So if you set a property during your build,
some existing dependent properties which were evaluated before the value change will
continue to use the old value. There is no way to re-evaluate those properties.
&lt;/p&gt;
&lt;p&gt;
Now lets see how this relates to the Configuration property specifically.
&lt;/p&gt;
&lt;p&gt;
The contents of the .csproj/.vbproj are properties/items along with an import to Microsoft.csharp.targets
(Microsoft.VisualBasic.targets for .vbproj) which then imports Microsoft.Common.targets.
If you look in Microsoft.common.targets you will see many different properties which
are declared using $(Configuration). So this means that you must treat the Configuration
property with care and abide by the rule that I have outlined above.
&lt;/p&gt;
&lt;p&gt;
FYI If you want more details on this I have explained this entire process in great
detail in my book &lt;a href="http://www.amazon.com/gp/product/0735645248?ie=UTF8&amp;amp;tag=sedodream-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=0735645248" target="_blank"&gt;Inside
MSBuild and Team Build&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;u&gt;Configuration for web publishing&lt;/u&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
If you have used the new web publish experience in Visual Studio 2012 (also available
for VS2010 from the &lt;a href="https://www.windowsazure.com/en-us/develop/net/#" target="_blank"&gt;Azure
SDK&lt;/a&gt;) you may have noticed that the web publish profiles are MSBuild files. They
are stored under Properties\PublishProfiles (My Project\PublishProfiles for VB) and
have extensions of .pubxml. In that file (or in a .pubxml.user file associated with
it) you will find a property defined as
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;LastUsedBuildConfiguration&amp;gt;Release&amp;lt;/LastUsedBulidConfiguration&amp;gt;&lt;/pre&gt;
&lt;p&gt;
This value corresponds to the value for the Configuration drop down in the VS web
publish dialog. When you kick off a publish in VS we use this value and kick off a
build and specify Configuration as a global property which is passed in. The reason
why we did not name this property Configuration is because the web publish profile
is imported into the web project itself during the publish process. By the file being
imported you can natively access all the properties/items of the .csproj/.vbproj and
also easily extend the build process. Since that is the case we cannot set the Configuration
property because we know it’s value has already been set. Due to this when publishing
from the command line you must specify the Configuration property.
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi | &lt;a href="http://twitter.com/sayedihashimi" target="_blank"&gt;@SayedIHashimi&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,ca9825b2-a384-4d68-9413-e774948bbd58.aspx</comments>
      <category>MSBuild</category>
      <category>MSDeploy</category>
      <category>Visual Studio</category>
      <category>Visual Studio 2008</category>
      <category>Visual Studio 2010</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=d611171d-d017-4d14-a131-9230df2d899a</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,d611171d-d017-4d14-a131-9230df2d899a.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,d611171d-d017-4d14-a131-9230df2d899a.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=d611171d-d017-4d14-a131-9230df2d899a</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Today I saw the following question on StackOverflow <a href="http://stackoverflow.com/q/11885454/105999" target="_blank">MSDeploy
- Deploying Contents of a Folder to a Remote IIS Server</a> and decided to write this
post to answer the question.
</p>
        <p>
Web Deploy (aka MSDeploy) uses a provider model and there are a <a href="http://technet.microsoft.com/en-us/library/dd569040(v=ws.10)" target="_blank">good
number of providers</a> available out of the box. To give you an example of some of
the providers; when syncing an IIS web application you will use iisApp, for an MSDeploy
package you will use package, for a web server webServer, etc. If you want to sync
a local folder to a remote IIS path then you can use the <a href="http://technet.microsoft.com/en-us/library/dd569034(v=ws.10)" target="_blank">contentPath</a> provider.
You can also use this provider to sync a folder from one website to another website.
</p>
        <p>
The general idea of what we want to do in this case is to sync a folder from your
PC to your IIS website. Calls to msdeploy.exe can be a bit verbose so let’s construct
the command one step at at time. We will use the template below.
</p>
        <pre class="brush: xml;">msdeploy.exe -verb:sync -source:contentPath="" -dest:contentPath=""</pre>
        <p>
We use the sync verb to describe what we are trying to do, and then use the contentPath
provider for both the source and the dest. Now let’s fill in what those values should
be. For the source value you will need to pass in the full path to the folder that
you want to sync. In my case the files are at <em>C:\temp\files-to-pub</em>. For the
dest value you will give the path to the folder as an IIS path. In my case the website
that I’m syncing to is named <em>sayedupdemo</em> so the IIS path that I want to sync
is ‘sayedupdemo/files-to-pub’. Now that give us.
</p>
        <pre class="brush: xml;">msdeploy.exe –verb:sync -source:contentPath="C:\temp\files-to-pub" -dest:contentPath='sayedupdemo/files-to-pub'</pre>
        <p>
For the dest value we have not given any parameters indicating what server those command
are supposed to be sent to. We will need to add those parameters. The parameters which
typically need to be passed in are.
</p>
        <ul>
          <li>
ComputerName – this is the URL or computer name which will handle the publish operation 
</li>
          <li>
Username – the username 
</li>
          <li>
Password – the password 
</li>
          <li>
AuthType – the <a href="http://technet.microsoft.com/en-us/library/dd569001(v=WS.10).aspx" target="_blank">authType</a> to
be used. Either NTLM or Basic. For WMSvc this is typically Basic, for Remote Agent
Service this is NTLM</li>
        </ul>
        <p>
In my case I’m publishing to a <a href="https://www.windowsazure.com/en-us/home/features/web-sites/?WT.mc_id=cmp_pst001_blg_post0171web" target="_blank">Windows
Azure Web Site</a>. So the values that I will use are:
</p>
        <ul>
          <li>
ComputerName: <a title="https://waws-prod-blu-001.publish.azurewebsites.windows.net/msdeploy.axd?site=sayedupdemo" href="https://waws-prod-blu-001.publish.azurewebsites.windows.net/msdeploy.axd?site=sayedupdemo">https://waws-prod-blu-001.publish.azurewebsites.windows.net/msdeploy.axd?site=sayedupdemo</a></li>
          <li>
Username: $sayedupdemo 
</li>
          <li>
Password: thisIsNotMyRealPassword 
</li>
          <li>
AuthType: Basic<!--EndFragment--></li>
        </ul>
        <p>
All of these values can be found in the .publishSettings file (<em>can be downloaded
from Web Site dashboard from WindowsAzure.com</em>). For the ComputerName value you
will need to append the name of your site to get the full URL. In the example above
I manually added <strong>?site=sayedupdemo</strong>, this is the same name as shown
in the Azure portal. So now the command which we have is.
</p>
        <pre class="brush: xml;">msdeploy.exe 
    –verb:sync 
    -source:contentPath="C:\temp\files-to-pub" 
    -dest:contentPath='sayedupdemo/files-to-pub'
            ,ComputerName="https://waws-prod-blu-001.publish.azurewebsites.windows.net/msdeploy.axd?site=sayedupdemo"
            ,UserName='$sayedupdemo'
            ,Password='thisIsNotMyRealPassword'
            ,AuthType='Basic' </pre>
        <p>
OK we are almost there! In my case I want to make sure that I do not delete any files
from the server during this process. So I will also add <strong>–enableRule:DoNotDeleteRule</strong>.
So our command is now.
</p>
        <pre class="brush: xml;">msdeploy.exe 
    –verb:sync 
    -source:contentPath="C:\temp\files-to-pub" 
    -dest:contentPath='sayedupdemo/files-to-pub'
            ,ComputerName="https://waws-prod-blu-001.publish.azurewebsites.windows.net/msdeploy.axd?site=sayedupdemo"
            ,UserName='$sayedupdemo'
            ,Password='thisIsNotMyRealPassword'
            ,AuthType='Basic' 
    -enableRule:DoNotDeleteRule </pre>
        <p>
At this point before I execute this command I’ll first execute it passing <strong>–whatif</strong>.
This will give me a summary of what operations will be without actually causing any
changes. When I do this the result is shown in the image below.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/MSDeploy-how-to-sync-a-folder_11057/SNAGHTML204f5cd.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="SNAGHTML204f5cd" border="0" alt="SNAGHTML204f5cd" src="http://sedodream.com/content/binary/Windows-Live-Writer/MSDeploy-how-to-sync-a-folder_11057/SNAGHTML204f5cd_thumb.png" width="644" height="379" />
          </a>
        </p>
        <p>
After I verified that the changes are all intentional, I removed the <strong>–whatif</strong> and
executed the command. After that the local files were published to the remote server.
Now that I have synced the files each publish after this will be result in only changed
files being published. 
</p>
        <p>
If you want to learn how to snyc an individual file you can see my previous blog post <a href="http://sedodream.com/2012/01/08/HowToTakeYourWebAppOfflineDuringPublishing.aspx" target="_blank">How
to take your web app offline during publishing</a>.
</p>
        <h3>dest:auto
</h3>
        <p>
In the case of the question it was asked with dest:auto, you can use that but you
will have to pass in the IIS app name as a parameter and it will replace the path
to the folder. Below is the command. 
<br /></p>
        <pre class="brush: xml;">msdeploy.exe 
    -verb:sync
    -source:contentPath="C:\temp\files-to-pub" 
    -dest:auto
        ,ComputerName="https://waws-prod-blu-001.publish.azurewebsites.windows.net/msdeploy.axd?site=sayedupdemo"
        ,UserName='$sayedupdemo'
        ,Password='thisIsNotMyRealPassword'
        ,AuthType='Basic' 
-enableRule:DoNotDeleteRule 
-setParam:value='sayedupdemo',kind=ProviderPath,scope=contentPath,match='^C:\\temp\\files-to-pub$'</pre>
        <p>
Thanks, 
<br />
Sayed Ibrahim Hashimi <a href="https://twitter.com/sayedihashimi" target="_blank">@SayedIHashimi</a></p>
      </body>
      <title>Web Deploy (MSDeploy) how to sync a folder</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,d611171d-d017-4d14-a131-9230df2d899a.aspx</guid>
      <link>http://sedodream.com/2012/08/20/WebDeployMSDeployHowToSyncAFolder.aspx</link>
      <pubDate>Mon, 20 Aug 2012 03:08:11 GMT</pubDate>
      <description>&lt;p&gt;
Today I saw the following question on StackOverflow &lt;a href="http://stackoverflow.com/q/11885454/105999" target="_blank"&gt;MSDeploy
- Deploying Contents of a Folder to a Remote IIS Server&lt;/a&gt; and decided to write this
post to answer the question.
&lt;/p&gt;
&lt;p&gt;
Web Deploy (aka MSDeploy) uses a provider model and there are a &lt;a href="http://technet.microsoft.com/en-us/library/dd569040(v=ws.10)" target="_blank"&gt;good
number of providers&lt;/a&gt; available out of the box. To give you an example of some of
the providers; when syncing an IIS web application you will use iisApp, for an MSDeploy
package you will use package, for a web server webServer, etc. If you want to sync
a local folder to a remote IIS path then you can use the &lt;a href="http://technet.microsoft.com/en-us/library/dd569034(v=ws.10)" target="_blank"&gt;contentPath&lt;/a&gt; provider.
You can also use this provider to sync a folder from one website to another website.
&lt;/p&gt;
&lt;p&gt;
The general idea of what we want to do in this case is to sync a folder from your
PC to your IIS website. Calls to msdeploy.exe can be a bit verbose so let’s construct
the command one step at at time. We will use the template below.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;msdeploy.exe -verb:sync -source:contentPath=&amp;quot;&amp;quot; -dest:contentPath=&amp;quot;&amp;quot;&lt;/pre&gt;
&lt;p&gt;
We use the sync verb to describe what we are trying to do, and then use the contentPath
provider for both the source and the dest. Now let’s fill in what those values should
be. For the source value you will need to pass in the full path to the folder that
you want to sync. In my case the files are at &lt;em&gt;C:\temp\files-to-pub&lt;/em&gt;. For the
dest value you will give the path to the folder as an IIS path. In my case the website
that I’m syncing to is named &lt;em&gt;sayedupdemo&lt;/em&gt; so the IIS path that I want to sync
is ‘sayedupdemo/files-to-pub’. Now that give us.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;msdeploy.exe –verb:sync -source:contentPath=&amp;quot;C:\temp\files-to-pub&amp;quot; -dest:contentPath='sayedupdemo/files-to-pub'&lt;/pre&gt;
&lt;p&gt;
For the dest value we have not given any parameters indicating what server those command
are supposed to be sent to. We will need to add those parameters. The parameters which
typically need to be passed in are.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
ComputerName – this is the URL or computer name which will handle the publish operation 
&lt;/li&gt;
&lt;li&gt;
Username – the username 
&lt;/li&gt;
&lt;li&gt;
Password – the password 
&lt;/li&gt;
&lt;li&gt;
AuthType – the &lt;a href="http://technet.microsoft.com/en-us/library/dd569001(v=WS.10).aspx" target="_blank"&gt;authType&lt;/a&gt; to
be used. Either NTLM or Basic. For WMSvc this is typically Basic, for Remote Agent
Service this is NTLM&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
In my case I’m publishing to a &lt;a href="https://www.windowsazure.com/en-us/home/features/web-sites/?WT.mc_id=cmp_pst001_blg_post0171web" target="_blank"&gt;Windows
Azure Web Site&lt;/a&gt;. So the values that I will use are:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
ComputerName: &lt;a title="https://waws-prod-blu-001.publish.azurewebsites.windows.net/msdeploy.axd?site=sayedupdemo" href="https://waws-prod-blu-001.publish.azurewebsites.windows.net/msdeploy.axd?site=sayedupdemo"&gt;https://waws-prod-blu-001.publish.azurewebsites.windows.net/msdeploy.axd?site=sayedupdemo&lt;/a&gt; 
&lt;/li&gt;
&lt;li&gt;
Username: $sayedupdemo 
&lt;/li&gt;
&lt;li&gt;
Password: thisIsNotMyRealPassword 
&lt;/li&gt;
&lt;li&gt;
AuthType: Basic&lt;!--EndFragment--&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
All of these values can be found in the .publishSettings file (&lt;em&gt;can be downloaded
from Web Site dashboard from WindowsAzure.com&lt;/em&gt;). For the ComputerName value you
will need to append the name of your site to get the full URL. In the example above
I manually added &lt;strong&gt;?site=sayedupdemo&lt;/strong&gt;, this is the same name as shown
in the Azure portal. So now the command which we have is.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;msdeploy.exe 
    –verb:sync 
    -source:contentPath=&amp;quot;C:\temp\files-to-pub&amp;quot; 
    -dest:contentPath='sayedupdemo/files-to-pub'
            ,ComputerName=&amp;quot;https://waws-prod-blu-001.publish.azurewebsites.windows.net/msdeploy.axd?site=sayedupdemo&amp;quot;
            ,UserName='$sayedupdemo'
            ,Password='thisIsNotMyRealPassword'
            ,AuthType='Basic' &lt;/pre&gt;
&lt;p&gt;
OK we are almost there! In my case I want to make sure that I do not delete any files
from the server during this process. So I will also add &lt;strong&gt;–enableRule:DoNotDeleteRule&lt;/strong&gt;.
So our command is now.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;msdeploy.exe 
    –verb:sync 
    -source:contentPath=&amp;quot;C:\temp\files-to-pub&amp;quot; 
    -dest:contentPath='sayedupdemo/files-to-pub'
            ,ComputerName=&amp;quot;https://waws-prod-blu-001.publish.azurewebsites.windows.net/msdeploy.axd?site=sayedupdemo&amp;quot;
            ,UserName='$sayedupdemo'
            ,Password='thisIsNotMyRealPassword'
            ,AuthType='Basic' 
    -enableRule:DoNotDeleteRule &lt;/pre&gt;
&lt;p&gt;
At this point before I execute this command I’ll first execute it passing &lt;strong&gt;–whatif&lt;/strong&gt;.
This will give me a summary of what operations will be without actually causing any
changes. When I do this the result is shown in the image below.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/MSDeploy-how-to-sync-a-folder_11057/SNAGHTML204f5cd.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="SNAGHTML204f5cd" border="0" alt="SNAGHTML204f5cd" src="http://sedodream.com/content/binary/Windows-Live-Writer/MSDeploy-how-to-sync-a-folder_11057/SNAGHTML204f5cd_thumb.png" width="644" height="379" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
After I verified that the changes are all intentional, I removed the &lt;strong&gt;–whatif&lt;/strong&gt; and
executed the command. After that the local files were published to the remote server.
Now that I have synced the files each publish after this will be result in only changed
files being published. 
&lt;/p&gt;
&lt;p&gt;
If you want to learn how to snyc an individual file you can see my previous blog post &lt;a href="http://sedodream.com/2012/01/08/HowToTakeYourWebAppOfflineDuringPublishing.aspx" target="_blank"&gt;How
to take your web app offline during publishing&lt;/a&gt;.
&lt;/p&gt;
&lt;h3&gt;dest:auto
&lt;/h3&gt;
&lt;p&gt;
In the case of the question it was asked with dest:auto, you can use that but you
will have to pass in the IIS app name as a parameter and it will replace the path
to the folder. Below is the command. 
&lt;br /&gt;
&lt;pre class="brush: xml;"&gt;msdeploy.exe 
    -verb:sync
    -source:contentPath=&amp;quot;C:\temp\files-to-pub&amp;quot; 
    -dest:auto
        ,ComputerName=&amp;quot;https://waws-prod-blu-001.publish.azurewebsites.windows.net/msdeploy.axd?site=sayedupdemo&amp;quot;
        ,UserName='$sayedupdemo'
        ,Password='thisIsNotMyRealPassword'
        ,AuthType='Basic' 
-enableRule:DoNotDeleteRule 
-setParam:value='sayedupdemo',kind=ProviderPath,scope=contentPath,match='^C:\\temp\\files-to-pub$'&lt;/pre&gt;
&gt;
&lt;p&gt;
Thanks, 
&lt;br /&gt;
Sayed Ibrahim Hashimi &lt;a href="https://twitter.com/sayedihashimi" target="_blank"&gt;@SayedIHashimi&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,d611171d-d017-4d14-a131-9230df2d899a.aspx</comments>
      <category>MSDeploy</category>
      <category>Visual Studio</category>
      <category>web</category>
      <category>Web Deployment Tool</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=38173cb5-ee11-4244-895c-dacb46f36279</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,38173cb5-ee11-4244-895c-dacb46f36279.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,38173cb5-ee11-4244-895c-dacb46f36279.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=38173cb5-ee11-4244-895c-dacb46f36279</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The release of Visual Studio 2012 is <a href="http://blogs.msdn.com/b/somasegar/archive/2012/08/01/visual-studio-2012-and-net-4-5-complete.aspx">right
around the corner</a>. If you’ve been following our blog/twitter then you may know
that many of the Web related components of Visual Studio are now“out-of-band”, meaning
that we can update them independently of Visual Studio itself. Because of this we
are planning to ship updates a few times a year. We are currently in the process for
planning our first update for VS 2012 and we wanted to share some of the items that
we are planning to work on. We would like to get your feedback on these ideas to ensure
that we are doing the right things. If you have comments please do let us know. FYI
the updates that I describe below will be made available for both VS 2012 as well
as VS 2010.
</p>
        <h1>Website Project Updates
</h1>
        <p>
When you use Visual Studio there are two types of web projects you can create: a Web
Application Project (WAP, this includes MVC) and a Website Project (WSP). In VS 2012
we did a lot of work to update the publish experience for WAPs. When we set out for
these updates we planned to take these enhancements and make the available to Website
projects as well. As we progressed it became evident that we did not have the resources
to implement the features for both WAP and WSP in time for VS 2012. So we focused
on creating the right experience for WAPs and we also added an extensibility point
into WSP which will allow us to replace the existing publish dialog. The reason why
we focused on WAP first was because WAPs already have support for Web Deploy (MSDeploy)
based publishing as well as a formal build/publish process captured in MSBuild. WSP
does not have either of these so it would have taken more time to start with WSP.
</p>
        <p>
When VS 2012 is released the publish experience for WSP will be the same which was
available in VS2010 but we will have a release a few months after the release which
will bring all the publish goodness to Website Projects! This will include all the
features which are available to Web Application Projects including; the ability to
publish using. 
</p>
        <ul>
          <li>
Publishing methods MSDeploy / MSDeploy package / FTP / File System / FPSE 
</li>
          <li>
Ability to have multiple publish profiles, which can be stored in version control 
</li>
          <li>
Command line publishing 
</li>
          <li>
            <a href="http://msdn.microsoft.com/en-us/library/dd465326.aspx">web.config transforms</a>
          </li>
          <li>
Enabling Entity Framework CF migrations in web.config during publish 
</li>
          <li>
Incremental database schema publish 
</li>
          <li>
File preview 
</li>
          <li>
etc 
</li>
        </ul>
        <p>
Since both project systems will be using the exact same code whenever we add a feature
it will immediately be available to both. In today’s world they are two entirely different
code bases (<em>the WSP publishing experience is currently native code where as the
WAP publish dialog is managed</em>). This will allow us to maintain a consistent publish
experience and also enable us to deliver features more quickly.
</p>
        <p>
Since WSP does not have a “build” process you might be wondering how we are planning
to hook this all together since our entire publish pipeline is captured in MSBuild.
Here is a rough idea of what we are currently thinking. After you use the new publish
dialog to create a publish profile for the first time we will do a number of things:
</p>
        <ol>
          <li>
Create a new folder to contain needed artifacts 
<ol><li>
The folder may be in the root of the Website project, but we are considering placing
it somewhere outside as well 
</li><li>
The name of this folder is not yet finalized, but it could be something like _Publish
or _Project 
</li></ol></li>
          <li>
Create an MSBuild file for the Website in that folder, this will capture information
like; included files, references, properties to control publish process 
<ol><li>
The primary purpose of dropping this file is to facilitate command line publish scenarios,
without this we could publish from Visual Studio but not from the command line 
</li><li>
When you make changes in Visual Studio like adding a reference we will automatically
keep this file up to date 
</li></ol></li>
          <li>
Create the publish profile in that folder (<em>this is a .pubxml file</em>) 
</li>
          <li>
When the site is being published the working directory (i.e. obj\ folder) will be
outside the root of the website, most likely in the same folder which contains the
WSP root 
</li>
        </ol>
        <p>
After we have those things in place for the most part the publish dialog will be able
to treat both projects in the same way. These files will by default be stored in version
control and can be shared with other team members. Sensitive information such as the
MSDeploy password will be stored in another file and encrypted per-user/per-machine
in a .user file which is not checked in.
</p>
        <h1>Web Deployment Projects
</h1>
        <p>
A few months after Visual Studio 2005 shipped we released the first version of <a href="http://msdn.microsoft.com/en-us/library/aa479568.aspx">Web
Deployment Projects</a>, and we updated WDP for both VS 2008 and VS 2010 and released
them a few months after each of those releases as well. WDPs are used for a few different
scenarios including the following.
</p>
        <ol>
          <li>
Publishing a Website project using MSDeploy 
</li>
          <li>
Command line publish support 
</li>
          <li>
Customizing the publish process for a WAP 
</li>
          <li>
Running ASP.NET precompile/merge for a WSP or WAP 
</li>
        </ol>
        <p>
When we looked at the scenarios that WDPs are typically used for and then compared
that to features which we have for WAP and WSP (<em>after the updates mentioned above</em>)
we noticed that most (<em>if not all</em>) scenarios where WDP is used can be covered
without requiring a WDP. Our new publish experience already has first class support
for MSDeploy, command line publishing, and for extensibility so that covers #1-#3.
Regarding #4 for WAPs we have already added ASP.NET precompile/merge as a publish
option (<em>you can find it in the Package/Publish Web tab</em>). Since WSP does not
have any property pages we are likely to move that option to being on the publish
dialog itself or we will expose those options in another way for WSP. We have not
yet settled on that design.
</p>
        <p>
It may not seem like it but updating WDP to support VS2012 is a <strong>significant
effort</strong>. Knowing that, and that most of the scenarios where WDP are used can
now be transitioned to the new experience, we have decided to invest in giving WSP
projects first class publishing support instead of updating VS 2012 to support WDP.
We think that this is the right decision because we are unifying the publish experience
for both project systems and it allows us to create a deeper set of features going
forward instead of investing in different things and wasting effort. If you have a
scenario that you think we have missed please do not hesitate to reach out to me by
email at <a href="mailto:sayedha@microsoft.com">sayedha@microsoft.com</a> and let
me know.
</p>
        <p>
          <br />
Sayed Ibrahim Hashimi | <a href="http://twitter.com/sayedihashimi">@SayedIHashimi</a></p>
      </body>
      <title>Plans regarding Website projects and Web Deployment Projects</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,38173cb5-ee11-4244-895c-dacb46f36279.aspx</guid>
      <link>http://sedodream.com/2012/08/06/PlansRegardingWebsiteProjectsAndWebDeploymentProjects.aspx</link>
      <pubDate>Mon, 06 Aug 2012 21:16:47 GMT</pubDate>
      <description>&lt;p&gt;
The release of Visual Studio 2012 is &lt;a href="http://blogs.msdn.com/b/somasegar/archive/2012/08/01/visual-studio-2012-and-net-4-5-complete.aspx"&gt;right
around the corner&lt;/a&gt;. If you’ve been following our blog/twitter then you may know
that many of the Web related components of Visual Studio are now“out-of-band”, meaning
that we can update them independently of Visual Studio itself. Because of this we
are planning to ship updates a few times a year. We are currently in the process for
planning our first update for VS 2012 and we wanted to share some of the items that
we are planning to work on. We would like to get your feedback on these ideas to ensure
that we are doing the right things. If you have comments please do let us know. FYI
the updates that I describe below will be made available for both VS 2012 as well
as VS 2010.
&lt;/p&gt;
&lt;h1&gt;Website Project Updates
&lt;/h1&gt;
&lt;p&gt;
When you use Visual Studio there are two types of web projects you can create: a Web
Application Project (WAP, this includes MVC) and a Website Project (WSP). In VS 2012
we did a lot of work to update the publish experience for WAPs. When we set out for
these updates we planned to take these enhancements and make the available to Website
projects as well. As we progressed it became evident that we did not have the resources
to implement the features for both WAP and WSP in time for VS 2012. So we focused
on creating the right experience for WAPs and we also added an extensibility point
into WSP which will allow us to replace the existing publish dialog. The reason why
we focused on WAP first was because WAPs already have support for Web Deploy (MSDeploy)
based publishing as well as a formal build/publish process captured in MSBuild. WSP
does not have either of these so it would have taken more time to start with WSP.
&lt;/p&gt;
&lt;p&gt;
When VS 2012 is released the publish experience for WSP will be the same which was
available in VS2010 but we will have a release a few months after the release which
will bring all the publish goodness to Website Projects! This will include all the
features which are available to Web Application Projects including; the ability to
publish using. 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Publishing methods MSDeploy / MSDeploy package / FTP / File System / FPSE 
&lt;/li&gt;
&lt;li&gt;
Ability to have multiple publish profiles, which can be stored in version control 
&lt;/li&gt;
&lt;li&gt;
Command line publishing 
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://msdn.microsoft.com/en-us/library/dd465326.aspx"&gt;web.config transforms&lt;/a&gt; 
&lt;/li&gt;
&lt;li&gt;
Enabling Entity Framework CF migrations in web.config during publish 
&lt;/li&gt;
&lt;li&gt;
Incremental database schema publish 
&lt;/li&gt;
&lt;li&gt;
File preview 
&lt;/li&gt;
&lt;li&gt;
etc 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Since both project systems will be using the exact same code whenever we add a feature
it will immediately be available to both. In today’s world they are two entirely different
code bases (&lt;em&gt;the WSP publishing experience is currently native code where as the
WAP publish dialog is managed&lt;/em&gt;). This will allow us to maintain a consistent publish
experience and also enable us to deliver features more quickly.
&lt;/p&gt;
&lt;p&gt;
Since WSP does not have a “build” process you might be wondering how we are planning
to hook this all together since our entire publish pipeline is captured in MSBuild.
Here is a rough idea of what we are currently thinking. After you use the new publish
dialog to create a publish profile for the first time we will do a number of things:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Create a new folder to contain needed artifacts 
&lt;ol&gt;
&lt;li&gt;
The folder may be in the root of the Website project, but we are considering placing
it somewhere outside as well 
&lt;/li&gt;
&lt;li&gt;
The name of this folder is not yet finalized, but it could be something like _Publish
or _Project 
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
Create an MSBuild file for the Website in that folder, this will capture information
like; included files, references, properties to control publish process 
&lt;ol&gt;
&lt;li&gt;
The primary purpose of dropping this file is to facilitate command line publish scenarios,
without this we could publish from Visual Studio but not from the command line 
&lt;/li&gt;
&lt;li&gt;
When you make changes in Visual Studio like adding a reference we will automatically
keep this file up to date 
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
Create the publish profile in that folder (&lt;em&gt;this is a .pubxml file&lt;/em&gt;) 
&lt;/li&gt;
&lt;li&gt;
When the site is being published the working directory (i.e. obj\ folder) will be
outside the root of the website, most likely in the same folder which contains the
WSP root 
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
After we have those things in place for the most part the publish dialog will be able
to treat both projects in the same way. These files will by default be stored in version
control and can be shared with other team members. Sensitive information such as the
MSDeploy password will be stored in another file and encrypted per-user/per-machine
in a .user file which is not checked in.
&lt;/p&gt;
&lt;h1&gt;Web Deployment Projects
&lt;/h1&gt;
&lt;p&gt;
A few months after Visual Studio 2005 shipped we released the first version of &lt;a href="http://msdn.microsoft.com/en-us/library/aa479568.aspx"&gt;Web
Deployment Projects&lt;/a&gt;, and we updated WDP for both VS 2008 and VS 2010 and released
them a few months after each of those releases as well. WDPs are used for a few different
scenarios including the following.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Publishing a Website project using MSDeploy 
&lt;/li&gt;
&lt;li&gt;
Command line publish support 
&lt;/li&gt;
&lt;li&gt;
Customizing the publish process for a WAP 
&lt;/li&gt;
&lt;li&gt;
Running ASP.NET precompile/merge for a WSP or WAP 
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
When we looked at the scenarios that WDPs are typically used for and then compared
that to features which we have for WAP and WSP (&lt;em&gt;after the updates mentioned above&lt;/em&gt;)
we noticed that most (&lt;em&gt;if not all&lt;/em&gt;) scenarios where WDP is used can be covered
without requiring a WDP. Our new publish experience already has first class support
for MSDeploy, command line publishing, and for extensibility so that covers #1-#3.
Regarding #4 for WAPs we have already added ASP.NET precompile/merge as a publish
option (&lt;em&gt;you can find it in the Package/Publish Web tab&lt;/em&gt;). Since WSP does not
have any property pages we are likely to move that option to being on the publish
dialog itself or we will expose those options in another way for WSP. We have not
yet settled on that design.
&lt;/p&gt;
&lt;p&gt;
It may not seem like it but updating WDP to support VS2012 is a &lt;strong&gt;significant
effort&lt;/strong&gt;. Knowing that, and that most of the scenarios where WDP are used can
now be transitioned to the new experience, we have decided to invest in giving WSP
projects first class publishing support instead of updating VS 2012 to support WDP.
We think that this is the right decision because we are unifying the publish experience
for both project systems and it allows us to create a deeper set of features going
forward instead of investing in different things and wasting effort. If you have a
scenario that you think we have missed please do not hesitate to reach out to me by
email at &lt;a href="mailto:sayedha@microsoft.com"&gt;sayedha@microsoft.com&lt;/a&gt; and let
me know.
&lt;/p&gt;
&lt;p&gt;
&lt;br /&gt;
Sayed Ibrahim Hashimi | &lt;a href="http://twitter.com/sayedihashimi"&gt;@SayedIHashimi&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,38173cb5-ee11-4244-895c-dacb46f36279.aspx</comments>
      <category>asp.net</category>
      <category>MSDeploy</category>
      <category>Visual Studio</category>
      <category>Visual Studio 2010</category>
      <category>Visual Studio 2012</category>
      <category>Web Publishing Pipeline</category>
    </item>
    <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=604eadfe-46bf-4989-bac8-814e2701e52a</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,604eadfe-46bf-4989-bac8-814e2701e52a.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,604eadfe-46bf-4989-bac8-814e2701e52a.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=604eadfe-46bf-4989-bac8-814e2701e52a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you have used the Visual Studio web publish in either VS 2010 or VS 11 to create
Web Deploy packages then you probably know that we parameterize connection strings
in web.config automatically. In case you are not familiar with Web Deploy parameters,
they are a way to declare that you want to easily be able to update a value of something
when publishing the package later on. Connection strings are good examples of something
which typically needs to be updated during publish.
</p>
        <p>
As I previously stated if you create a Web Deploy package in Visual Studio we will
automatically create Web Deploy parameters for all your connection strings in web.config.
Earlier today I saw a <a href="http://stackoverflow.com/questions/10411326/how-to-convert-configsource-to-inline-elements-in-web-config-on-transformation">question
on StackOverflow asking how to parameterize connection strings in non-web.config</a> files
(<em>question actually asked something else, but I think this is what he’s really
wanting</em>). I created a sample showing how to do this. Below is what the connectionStrings
element looks like in web.config.
</p>
        <pre class="brush: xml;">&lt;connectionStrings configSource="connectionStrings.config" /&gt;</pre>
        <p>
And here is connectionStrings.config
</p>
        <pre class="brush: xml;">&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;connectionStrings&gt;
  &lt;clear/&gt;
  &lt;add name="ApplicationServices"
           connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
           providerName="System.Data.SqlClient" /&gt;
  &lt;add name="OtherConnectionString"
       connectionString="data source=.\SQLExpress;Integrated Security=SSPI;Initial Catalog=foo"
       providerName="System.Data.SqlClient"/&gt;
&lt;/connectionStrings&gt;</pre>
        <p>
In order to parameterize these connection strings you will have to extend the Web
Publish Pipeline. To do that create a file named <strong>{project-name}.wpp.targets</strong> in
the root of the project in which you are working (for VS 11 projects you can place
all this directly inside of the .pubxml files). This will be an MSBuild file which
will get imported into the build/publish process. Below is the file which needs to
be created.
</p>
        <pre class="brush: xml;">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;

  &lt;ItemGroup&gt;
    &lt;!-- Here we need to declare MSDeploy parameters for connection strings in connectionStrings.config --&gt;
    &lt;MsDeployDeclareParameters Include="ApplicationServices-ConnectionString" &gt;
      &lt;Kind&gt;XmlFile&lt;/Kind&gt;
      &lt;Scope&gt;connectionStrings.config$&lt;/Scope&gt;
      &lt;Match&gt;/connectionStrings/add[@name='ApplicationServices']/@connectionString&lt;/Match&gt;
      &lt;Description&gt;Connection string for ApplicationServices&lt;/Description&gt;
      &lt;DefaultValue&gt;data source=(localhost);Initial Catalog=AppServices&lt;/DefaultValue&gt;
      &lt;Tags&gt;SqlConnectionString&lt;/Tags&gt;
    &lt;/MsDeployDeclareParameters&gt;

    &lt;MsDeployDeclareParameters Include="OtherConnectionString-ConnectionString" &gt;
      &lt;Kind&gt;XmlFile&lt;/Kind&gt;
      &lt;Scope&gt;connectionStrings.config$&lt;/Scope&gt;
      &lt;Match&gt;/connectionStrings/add[@name='OtherConnectionString']/@connectionString&lt;/Match&gt;
      &lt;Description&gt;Connection string for OtherConnectionString&lt;/Description&gt;
      &lt;DefaultValue&gt;data source=(localhost);Initial Catalog=OtherDb&lt;/DefaultValue&gt;
      &lt;Tags&gt;SqlConnectionString&lt;/Tags&gt;
    &lt;/MsDeployDeclareParameters&gt;
  &lt;/ItemGroup&gt;

&lt;/Project&gt;</pre>
        <p>
Here you can see that I am creating values for MSDeployDeclareParameters. When you
package/publish this item list is used to create the MSDeploy parameters. Below is
an explanation of the metadata values each contain.
</p>
        <ul>
          <li>
Kind = for this case it will always be Xmlfile, <a href="http://technet.microsoft.com/en-us/library/dd569084(v=WS.10).aspx">learn
more</a></li>
          <li>
Scope = a regular expression to the file which needs to be modified</li>
          <li>
Match = an XPath expression to the attribute/element to be updated</li>
          <li>
Description = optional description (this will show up in the IIS manager if the pkg
is imported)</li>
          <li>
DefaultValue = optional default value for the for the parameter</li>
          <li>
Tags = optional, for connection strings use SqlConnectionString</li>
        </ul>
        <p>
After you create this file you will need to close/re-open VS (it caches imported .targets
files). Then you can create a web deploy package. When you do so these new parameters
will be declared. In my case I then imported this in the IIS manager and here is the
dialog which shows up for the parameters.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/VS-Web-Publish-How-to-parameteriz.config_C47E/SNAGHTML94cce08.png">
            <img title="SNAGHTML94cce08" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="SNAGHTML94cce08" src="http://sedodream.com/content/binary/Windows-Live-Writer/VS-Web-Publish-How-to-parameteriz.config_C47E/SNAGHTML94cce08_thumb.png" width="691" height="525" />
          </a>
        </p>
        <p>
As you can see the Application Path parameter is shown there as well as my custom
connection string values. When I update the values in the text box and opened connectionStrings.config
on my web server they were the values I entered in the dialog box.
</p>
        <p>
FYI I have uploaded this sample to my github account at <a href="https://github.com/sayedihashimi/sayed-samples/tree/master/ParameterizeConStringConfig">ParameterizeConStringConfig</a>.
</p>
        <p>
Sayed Ibrahim Hashimi <a href="http://twitter.com/sayedihashimi">@SayedIHashimi</a></p>
      </body>
      <title>VS Web Publish: How to parameterize connection strings outside of web.config</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,604eadfe-46bf-4989-bac8-814e2701e52a.aspx</guid>
      <link>http://sedodream.com/2012/05/13/VSWebPublishHowToParameterizeConnectionStringsOutsideOfWebconfig.aspx</link>
      <pubDate>Sun, 13 May 2012 21:18:03 GMT</pubDate>
      <description>&lt;p&gt;
If you have used the Visual Studio web publish in either VS 2010 or VS 11 to create
Web Deploy packages then you probably know that we parameterize connection strings
in web.config automatically. In case you are not familiar with Web Deploy parameters,
they are a way to declare that you want to easily be able to update a value of something
when publishing the package later on. Connection strings are good examples of something
which typically needs to be updated during publish.
&lt;/p&gt;
&lt;p&gt;
As I previously stated if you create a Web Deploy package in Visual Studio we will
automatically create Web Deploy parameters for all your connection strings in web.config.
Earlier today I saw a &lt;a href="http://stackoverflow.com/questions/10411326/how-to-convert-configsource-to-inline-elements-in-web-config-on-transformation"&gt;question
on StackOverflow asking how to parameterize connection strings in non-web.config&lt;/a&gt; files
(&lt;em&gt;question actually asked something else, but I think this is what he’s really
wanting&lt;/em&gt;). I created a sample showing how to do this. Below is what the connectionStrings
element looks like in web.config.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;connectionStrings configSource=&amp;quot;connectionStrings.config&amp;quot; /&amp;gt;&lt;/pre&gt;
&lt;p&gt;
And here is connectionStrings.config
&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;connectionStrings&amp;gt;
  &amp;lt;clear/&amp;gt;
  &amp;lt;add name=&amp;quot;ApplicationServices&amp;quot;
           connectionString=&amp;quot;data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true&amp;quot;
           providerName=&amp;quot;System.Data.SqlClient&amp;quot; /&amp;gt;
  &amp;lt;add name=&amp;quot;OtherConnectionString&amp;quot;
       connectionString=&amp;quot;data source=.\SQLExpress;Integrated Security=SSPI;Initial Catalog=foo&amp;quot;
       providerName=&amp;quot;System.Data.SqlClient&amp;quot;/&amp;gt;
&amp;lt;/connectionStrings&amp;gt;&lt;/pre&gt;
&lt;p&gt;
In order to parameterize these connection strings you will have to extend the Web
Publish Pipeline. To do that create a file named &lt;strong&gt;{project-name}.wpp.targets&lt;/strong&gt; in
the root of the project in which you are working (for VS 11 projects you can place
all this directly inside of the .pubxml files). This will be an MSBuild file which
will get imported into the build/publish process. Below is the file which needs to
be created.
&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 ToolsVersion=&amp;quot;4.0&amp;quot; xmlns=&amp;quot;http://schemas.microsoft.com/developer/msbuild/2003&amp;quot;&amp;gt;

  &amp;lt;ItemGroup&amp;gt;
    &amp;lt;!-- Here we need to declare MSDeploy parameters for connection strings in connectionStrings.config --&amp;gt;
    &amp;lt;MsDeployDeclareParameters Include=&amp;quot;ApplicationServices-ConnectionString&amp;quot; &amp;gt;
      &amp;lt;Kind&amp;gt;XmlFile&amp;lt;/Kind&amp;gt;
      &amp;lt;Scope&amp;gt;connectionStrings.config$&amp;lt;/Scope&amp;gt;
      &amp;lt;Match&amp;gt;/connectionStrings/add[@name='ApplicationServices']/@connectionString&amp;lt;/Match&amp;gt;
      &amp;lt;Description&amp;gt;Connection string for ApplicationServices&amp;lt;/Description&amp;gt;
      &amp;lt;DefaultValue&amp;gt;data source=(localhost);Initial Catalog=AppServices&amp;lt;/DefaultValue&amp;gt;
      &amp;lt;Tags&amp;gt;SqlConnectionString&amp;lt;/Tags&amp;gt;
    &amp;lt;/MsDeployDeclareParameters&amp;gt;

    &amp;lt;MsDeployDeclareParameters Include=&amp;quot;OtherConnectionString-ConnectionString&amp;quot; &amp;gt;
      &amp;lt;Kind&amp;gt;XmlFile&amp;lt;/Kind&amp;gt;
      &amp;lt;Scope&amp;gt;connectionStrings.config$&amp;lt;/Scope&amp;gt;
      &amp;lt;Match&amp;gt;/connectionStrings/add[@name='OtherConnectionString']/@connectionString&amp;lt;/Match&amp;gt;
      &amp;lt;Description&amp;gt;Connection string for OtherConnectionString&amp;lt;/Description&amp;gt;
      &amp;lt;DefaultValue&amp;gt;data source=(localhost);Initial Catalog=OtherDb&amp;lt;/DefaultValue&amp;gt;
      &amp;lt;Tags&amp;gt;SqlConnectionString&amp;lt;/Tags&amp;gt;
    &amp;lt;/MsDeployDeclareParameters&amp;gt;
  &amp;lt;/ItemGroup&amp;gt;

&amp;lt;/Project&amp;gt;&lt;/pre&gt;
&lt;p&gt;
Here you can see that I am creating values for MSDeployDeclareParameters. When you
package/publish this item list is used to create the MSDeploy parameters. Below is
an explanation of the metadata values each contain.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Kind = for this case it will always be Xmlfile, &lt;a href="http://technet.microsoft.com/en-us/library/dd569084(v=WS.10).aspx"&gt;learn
more&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
Scope = a regular expression to the file which needs to be modified&lt;/li&gt;
&lt;li&gt;
Match = an XPath expression to the attribute/element to be updated&lt;/li&gt;
&lt;li&gt;
Description = optional description (this will show up in the IIS manager if the pkg
is imported)&lt;/li&gt;
&lt;li&gt;
DefaultValue = optional default value for the for the parameter&lt;/li&gt;
&lt;li&gt;
Tags = optional, for connection strings use SqlConnectionString&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
After you create this file you will need to close/re-open VS (it caches imported .targets
files). Then you can create a web deploy package. When you do so these new parameters
will be declared. In my case I then imported this in the IIS manager and here is the
dialog which shows up for the parameters.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/VS-Web-Publish-How-to-parameteriz.config_C47E/SNAGHTML94cce08.png"&gt;&lt;img title="SNAGHTML94cce08" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="SNAGHTML94cce08" src="http://sedodream.com/content/binary/Windows-Live-Writer/VS-Web-Publish-How-to-parameteriz.config_C47E/SNAGHTML94cce08_thumb.png" width="691" height="525" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
As you can see the Application Path parameter is shown there as well as my custom
connection string values. When I update the values in the text box and opened connectionStrings.config
on my web server they were the values I entered in the dialog box.
&lt;/p&gt;
&lt;p&gt;
FYI I have uploaded this sample to my github account at &lt;a href="https://github.com/sayedihashimi/sayed-samples/tree/master/ParameterizeConStringConfig"&gt;ParameterizeConStringConfig&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi &lt;a href="http://twitter.com/sayedihashimi"&gt;@SayedIHashimi&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,604eadfe-46bf-4989-bac8-814e2701e52a.aspx</comments>
      <category>MSBuild</category>
      <category>MSBuild 4.0</category>
      <category>MSDeploy</category>
      <category>Visual Studio</category>
      <category>Web Deployment Tool</category>
      <category>Web Publishing Pipeline</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=f623d885-ebb6-45c8-b0a3-f2d91e400d26</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,f623d885-ebb6-45c8-b0a3-f2d91e400d26.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,f623d885-ebb6-45c8-b0a3-f2d91e400d26.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=f623d885-ebb6-45c8-b0a3-f2d91e400d26</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
A couple months ago I <a href="http://sedodream.com/2011/12/24/PackageOncePublishAnywhere.aspx" target="_blank">blogged
about a Package-Web</a> which is a NuGet package that extends the web packaging process
in Visual Studio to enable you to create a single package which can be published to
multiple environments (<em>it captures all of your web.config transforms and has the
ability to transform on non-dev machines</em>). Since that release I have updated
the project and tonight I created a video which shows the features a bit you can <a href="http://youtu.be/-LvUJFI8CzM" target="_blank">check
it out on Youtube</a>. It’s embedded below.
</p>
        <iframe height="315" src="http://www.youtube.com/embed/-LvUJFI8CzM" frameborder="0" width="560" allowfullscreen="allowfullscreen">
        </iframe>
        <p>
          <strong>
            <font size="3">You can install this via NuGet, the package name is PackageWeb.</font>
          </strong>
        </p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/Package-web-updated-and-video-below_1440C/image_2.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="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/Package-web-updated-and-video-below_1440C/image_thumb.png" width="745" height="71" />
          </a>
        </p>
        <p>
Package-Web is an open source project and you can find it on my github account at <a href="https://github.com/sayedihashimi/package-web">https://github.com/sayedihashimi/package-web</a>.
</p>
        <p>
Thanks, 
<br />
Sayed Ibrahim Hashimi <a href="https://twitter.com/#!/sayedihashimi" target="_blank">@SayedIHashimi</a></p>
      </body>
      <title>Package web updated and video below</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,f623d885-ebb6-45c8-b0a3-f2d91e400d26.aspx</guid>
      <link>http://sedodream.com/2012/03/14/PackageWebUpdatedAndVideoBelow.aspx</link>
      <pubDate>Wed, 14 Mar 2012 06:08:57 GMT</pubDate>
      <description>&lt;p&gt;
A couple months ago I &lt;a href="http://sedodream.com/2011/12/24/PackageOncePublishAnywhere.aspx" target="_blank"&gt;blogged
about a Package-Web&lt;/a&gt; which is a NuGet package that extends the web packaging process
in Visual Studio to enable you to create a single package which can be published to
multiple environments (&lt;em&gt;it captures all of your web.config transforms and has the
ability to transform on non-dev machines&lt;/em&gt;). Since that release I have updated
the project and tonight I created a video which shows the features a bit you can &lt;a href="http://youtu.be/-LvUJFI8CzM" target="_blank"&gt;check
it out on Youtube&lt;/a&gt;. It’s embedded below.
&lt;/p&gt;
&lt;iframe height="315" src="http://www.youtube.com/embed/-LvUJFI8CzM" frameborder="0" width="560" allowfullscreen="allowfullscreen"&gt;
&lt;/iframe&gt;
&lt;p&gt;
&lt;strong&gt;&lt;font size="3"&gt;You can install this via NuGet, the package name is PackageWeb.&lt;/font&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/Package-web-updated-and-video-below_1440C/image_2.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="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/Package-web-updated-and-video-below_1440C/image_thumb.png" width="745" height="71" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Package-Web is an open source project and you can find it on my github account at &lt;a href="https://github.com/sayedihashimi/package-web"&gt;https://github.com/sayedihashimi/package-web&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Thanks, 
&lt;br /&gt;
Sayed Ibrahim Hashimi &lt;a href="https://twitter.com/#!/sayedihashimi" target="_blank"&gt;@SayedIHashimi&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,f623d885-ebb6-45c8-b0a3-f2d91e400d26.aspx</comments>
      <category>MSBuild</category>
      <category>MSDeploy</category>
      <category>Visual Studio</category>
      <category>web</category>
      <category>Web Deployment Tool</category>
      <category>Web Development</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=c3aa839b-d7dd-4847-b7ad-af347e1e86fc</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,c3aa839b-d7dd-4847-b7ad-af347e1e86fc.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,c3aa839b-d7dd-4847-b7ad-af347e1e86fc.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=c3aa839b-d7dd-4847-b7ad-af347e1e86fc</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The other day I saw a question posted on StackOverflow (<em>link to question below
in resources section</em>) asking if it was possible to update web.config using MSDeploy.
I actually used a technique where I updated a single file in one of my previous posts
at <a href="http://sedodream.com/2012/01/08/HowToTakeYourWebAppOfflineDuringPublishing.aspx">How
to take your web app offline during publishing</a> but it wasn’t called out too much.
In any case I’ll show you how you can update a single file (in this case web.config)
using MSDeploy.
</p>
        <p>
You can use the <a href="http://technet.microsoft.com/en-us/library/dd569034(WS.10).aspx">contentPath
provider</a> to facilitate updating a single file. Using contentPath you can sync
either a single file or an entire folder. You can also use IIS app paths to resolve
where the file/folder resides. For example if I have a web.config file in a local
folder named “C:\Data\Personal\My Repo\sayed-samples\UpdateWebConfig” and I want to
update my IIS site <strong>UpdateWebCfg </strong>running in the <strong>Default Web
Site </strong>on my folder I would use the command shown below.
</p>
        <pre class="brush: csharp;">%msdeploy% -verb:sync -source:contentPath="C:\Data\Personal\My Repo\sayed-samples\UpdateWebConfig\web.config" -dest:contentPath="Default Web Site/UpdateWebCfg/web.config"</pre>
        <p>
From the command above you can see that I set the source content path to the local
file and the dest content path using the IIS path <strong>{SiteName}/{AppName}/{file-path}</strong>.
In this case I am updating a site running in IIS on my local machine. In order to
update one that is running on a remote machine you will have to add ComputerName and
possibly some other values to the –dest argument.
</p>
        <p>
You can view the latest sources for this sample at my github repo, link is below.
</p>
        <p>
 
</p>
        <p>
Hope that helps!
</p>
        <p>
Sayed Ibrahim Hashimi – <a href="https://twitter.com/#!/sayedihashimi">@SayedIHashimi</a></p>
        <p>
Resources:
</p>
        <ul>
          <li>
            <a href="http://stackoverflow.com/questions/8803688/is-it-possible-to-modify-web-config-of-existing-site-using-msdeploy">StackOverflow
question – How to update web.config</a>
          </li>
          <li>
            <a href="https://github.com/sayedihashimi/sayed-samples/tree/master/UpdateWebConfig">Latest
sources for this sample on my github account</a>
          </li>
        </ul>
      </body>
      <title>How to update a single file using Web Deploy (MSDeploy)</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,c3aa839b-d7dd-4847-b7ad-af347e1e86fc.aspx</guid>
      <link>http://sedodream.com/2012/02/14/HowToUpdateASingleFileUsingWebDeployMSDeploy.aspx</link>
      <pubDate>Tue, 14 Feb 2012 19:17:30 GMT</pubDate>
      <description>&lt;p&gt;
The other day I saw a question posted on StackOverflow (&lt;em&gt;link to question below
in resources section&lt;/em&gt;) asking if it was possible to update web.config using MSDeploy.
I actually used a technique where I updated a single file in one of my previous posts
at &lt;a href="http://sedodream.com/2012/01/08/HowToTakeYourWebAppOfflineDuringPublishing.aspx"&gt;How
to take your web app offline during publishing&lt;/a&gt; but it wasn’t called out too much.
In any case I’ll show you how you can update a single file (in this case web.config)
using MSDeploy.
&lt;/p&gt;
&lt;p&gt;
You can use the &lt;a href="http://technet.microsoft.com/en-us/library/dd569034(WS.10).aspx"&gt;contentPath
provider&lt;/a&gt; to facilitate updating a single file. Using contentPath you can sync
either a single file or an entire folder. You can also use IIS app paths to resolve
where the file/folder resides. For example if I have a web.config file in a local
folder named “C:\Data\Personal\My Repo\sayed-samples\UpdateWebConfig” and I want to
update my IIS site &lt;strong&gt;UpdateWebCfg &lt;/strong&gt;running in the &lt;strong&gt;Default Web
Site &lt;/strong&gt;on my folder I would use the command shown below.
&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;%msdeploy% -verb:sync -source:contentPath=&amp;quot;C:\Data\Personal\My Repo\sayed-samples\UpdateWebConfig\web.config&amp;quot; -dest:contentPath=&amp;quot;Default Web Site/UpdateWebCfg/web.config&amp;quot;&lt;/pre&gt;
&lt;p&gt;
From the command above you can see that I set the source content path to the local
file and the dest content path using the IIS path &lt;strong&gt;{SiteName}/{AppName}/{file-path}&lt;/strong&gt;.
In this case I am updating a site running in IIS on my local machine. In order to
update one that is running on a remote machine you will have to add ComputerName and
possibly some other values to the –dest argument.
&lt;/p&gt;
&lt;p&gt;
You can view the latest sources for this sample at my github repo, link is below.
&lt;/p&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
Hope that helps!
&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;
&lt;a href="http://stackoverflow.com/questions/8803688/is-it-possible-to-modify-web-config-of-existing-site-using-msdeploy"&gt;StackOverflow
question – How to update web.config&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/sayedihashimi/sayed-samples/tree/master/UpdateWebConfig"&gt;Latest
sources for this sample on my github account&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,c3aa839b-d7dd-4847-b7ad-af347e1e86fc.aspx</comments>
      <category>IIS</category>
      <category>MSDeploy</category>
      <category>web</category>
      <category>Web Publishing Pipeline</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=7b98b9ee-5391-4ba5-9f64-bcbbe815035c</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,7b98b9ee-5391-4ba5-9f64-bcbbe815035c.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,7b98b9ee-5391-4ba5-9f64-bcbbe815035c.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=7b98b9ee-5391-4ba5-9f64-bcbbe815035c</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <em>Note: I’d like to thank Tom Dykstra for helping me put this together</em>
        </p>
        <h3>Overview
</h3>
        <p>
In this tutorial you'll see how to use a <em>web deployment package</em> package to
deploy an application. A deployment package is a <em>.zip</em> file that includes
all of the content and metadata that's required to deploy an application. 
</p>
        <p>
Deployment packages are often used in enterprise environments. This is because a developer
or a continuous integration server can create the package without needing to know
things like passwords that are stored in <em>Web.config</em> files. Only the server
administrator who actually installs the package needs to know those passwords, and
that person can enter the details at installation time.
</p>
        <p>
In a smaller organization that doesn't have separate people for these roles, there's
less need for deployment packages. But you can also use deployment packages as a way
to back up and restore the state of an application. After you use a deployment package
to deploy, you can save the package,. Then if a subsequent deployment has a problem,
you can quickly and easily restore the application state to the earlier state by reinstalling
the earlier package. (This scenario is more complicated if database changes are involved,
however.)
</p>
        <p>
This tutorial shows how to use Visual Studio to create a package and IIS Manager to
install it. For information about how to create and install packages using the command
line, see <a href="http://msdn.microsoft.com/en-us/library/bb386521.aspx">ASP.NET
Deployment Content Map</a> on the MSDN web site.
</p>
        <p>
To keep things relatively simple, this example assumes you have already deployed the
application and its databases, and you only need to deploy a code update. You have
made the code update, and you are ready to deploy it first to your test environment
(IIS on your local computer) and then to your hosting provider. You have a Test build
configuration that you use for the test environment and you use the Release build
configuration for the production environment. In the example, the name of the Visual
Studio project is ContosoUniversity, and instructions for its initial deployment can
be found in a series of tutorials that will be published in December on the ASP.NET
web site. 
</p>
        <p>
The hosting provider shown, Cytanium.com, is one of many that are available, and its
use here does not constitute an endorsement or recommendation.
</p>
        <blockquote>
          <p>
            <strong>Note</strong> The following example uses separate packages for the test and
production environments, but you can also create a single deployment package that
can be used for both environments. This would require that you use Web Deploy parameters
instead of <em>Web.config</em> transformations for <em>Web.config</em> file changes
that depend on deployment destination. For information about how to use Web Deploy
parameters, see <a href="http://msdn.microsoft.com/en-us/library/ff398068.aspx">How
to: Use Parameters to Configure Deployment Settings When a Package is Installed</a>.
</p>
        </blockquote>
        <h3>Configuring the Deployment Package
</h3>
        <p>
In this section, you'll configure settings for the deployment package. Some of these
settings are the same ones that you set also for one-click publish, others are only
for deployment packages. 
</p>
        <p>
Open the <strong>Package/Publish Web</strong> tab of the <strong>Project Properties</strong> window
and select the <strong>Test</strong> build configuration.
</p>
        <p>
For this deployment you aren't making any database changes, so clear <strong>Include
all databases configured in Package/Publish SQL tab</strong>. Make sure <strong>Exclude
files from the App_Data folder</strong> is selected.
</p>
        <p>
Review the settings in the section labeled <strong>Web Deployment Package Settings</strong>:
</p>
        <ul>
          <li>
By default, deployment packages are created as <em>.zip</em> files. You don't need
to change this setting. 
</li>
          <li>
By default, deployment packages are created in the project's <em>obj\Test\Package</em> folder.
You don't need to change this setting. 
</li>
          <li>
The default IIS web application name is the name of the project with "_deploy"
appended to it. Remove that suffix. You want the application to be named just ContosoUniversity
in IIS on your computer. 
</li>
          <li>
For this tutorial you're not deploying IIS settings, so you don't need to enter a
password for that. 
</li>
        </ul>
        <p>
The <strong>Package/Publish Web</strong> tab now looks like this:
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Package_Publish_Web_tab_Test_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="Package_Publish_Web_tab_Test" border="0" alt="Package_Publish_Web_tab_Test" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Package_Publish_Web_tab_Test_thumb.png" width="632" height="767" />
          </a>
        </p>
        <p>
You also need to configure settings for deploying to the production environment. Select
the <strong>Release</strong> build configuration to do that.
</p>
        <p>
Change <strong>IIS Web site/application name to use on the destination server</strong> to
a string that will serve as a reminder of what you need to do later when this value
is displayed in the IIS Manager UI: "[clear this field]". The text box on
this page won't stay cleared even if you clear it, so entering this note to yourself
will remind you to clear this value later when you deploy. When you deploy to your
hosting provider, you will connect to a site, not to a server, and in this case you
want to deploy to the root of the site.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Package_Publish_Web_tab_Release_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="Package_Publish_Web_tab_Release" border="0" alt="Package_Publish_Web_tab_Release" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Package_Publish_Web_tab_Release_thumb.png" width="634" height="769" />
          </a>
        </p>
        <h4>Creating a Deployment Package for the Test Environment
</h4>
        <p>
To create a deployment package, first make sure you've selected the right build configuration.
In the <strong>Solution Configurations</strong> drop-down box, select <strong>Test</strong>.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Solution_Configurations_dropdown_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="Solution_Configurations_dropdown" border="0" alt="Solution_Configurations_dropdown" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Solution_Configurations_dropdown_thumb.png" width="559" height="95" />
          </a>
        </p>
        <p>
In <strong>Solution Explorer</strong>, right-click the project that you want to build
the package for and then select <strong>Build Deployment Package</strong>.
</p>
        <p>
The <strong>Output</strong> window reports successful a build and publish (package
creation) and tells you where the package was created.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Output_Window_package_creation_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="Output_Window_package_creation" border="0" alt="Output_Window_package_creation" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Output_Window_package_creation_thumb.png" width="653" height="228" />
          </a>
        </p>
        <h4>Installing the Deployment Package in the Test Environment
</h4>
        <p>
The next step is to install the deployment package in IIS on your development computer. 
</p>
        <p>
Run <strong>IIS Manager</strong>. In the <strong>Connections</strong> pane of the <strong>IIS
Manager</strong> window, expand the local server node, expand the <strong>Sites</strong> node,
and select <strong>Default Web Site</strong>. Then in the <strong>Actions</strong> pane,
click <strong>Import Application</strong>. (If you don't see an <strong>Import Application</strong> link,
the most likely reason is that you have not installed Web Deploy. You can use the <a href="http://www.microsoft.com/web/downloads/platform.aspx">Web
Platform Installer</a> to install both IIS and Web Deploy.)
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Default_Web_Site_in_inetmgr_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="Default_Web_Site_in_inetmgr" border="0" alt="Default_Web_Site_in_inetmgr" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Default_Web_Site_in_inetmgr_thumb.png" width="607" height="464" />
          </a>
        </p>
        <p>
In the <strong>Select the Package</strong> wizard step, navigate to the location of
the package you just created. By default, that's the <em>obj\Test\Package</em> folder
in your ContosoUniversity project folder. (A package created with the <strong>Release</strong> build
configuration would be in <em>obj\Release\Package</em>.)
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Select_the_Package_dialog_box_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="Select_the_Package_dialog_box" border="0" alt="Select_the_Package_dialog_box" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Select_the_Package_dialog_box_thumb.png" width="650" height="500" />
          </a>
        </p>
        <p>
Click <strong>Next</strong>. The <strong>Select the Contents of the Package</strong> step
is displayed.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Select_the_Contents_of_the_Package_dialog_box_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="Select_the_Contents_of_the_Package_dialog_box" border="0" alt="Select_the_Contents_of_the_Package_dialog_box" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Select_the_Contents_of_the_Package_dialog_box_thumb.png" width="650" height="500" />
          </a>
        </p>
        <p>
Click <strong>Next</strong>. 
</p>
        <p>
The step that allows you to enter parameter values is displayed. The <strong>Application
Path</strong> value defaults to "ContosoUniversity", because that's what
you entered on the <strong>Package/Publish Web</strong> tab of the <strong>Project
Properties</strong> window.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Enter_Application_Package_Information_dialog_box_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="Enter_Application_Package_Information_dialog_box" border="0" alt="Enter_Application_Package_Information_dialog_box" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Enter_Application_Package_Information_dialog_box_thumb.png" width="650" height="500" />
          </a>
        </p>
        <p>
Click <strong>Next</strong>. 
</p>
        <p>
The wizard asks if you want to delete files at the destination that aren't in the
source. 
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Overwrite_Existing_Files_dialog_box_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="Overwrite_Existing_Files_dialog_box" border="0" alt="Overwrite_Existing_Files_dialog_box" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Overwrite_Existing_Files_dialog_box_thumb.png" width="650" height="500" />
          </a>
        </p>
        <p>
In this case you haven't deleted any files that you want to delete at the destination,
so the default (no deletions) is okay. Click <strong>Next</strong>. 
</p>
        <p>
          <strong>IIS Manager</strong> installs the package and reports its status.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Installation_Progress_and_Summary_dialog_box_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="Installation_Progress_and_Summary_dialog_box" border="0" alt="Installation_Progress_and_Summary_dialog_box" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Installation_Progress_and_Summary_dialog_box_thumb.png" width="650" height="500" />
          </a>
        </p>
        <p>
Click <strong>Finish</strong>. 
</p>
        <p>
Open a browser and run the application in test by going to the URL <code><a href="http://localhost/ContosoUniversity">http://localhost/ContosoUniversity</a></code>. 
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Instructors_page_with_separate_name_fields_Test_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="Instructors_page_with_separate_name_fields_Test" border="0" alt="Instructors_page_with_separate_name_fields_Test" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Instructors_page_with_separate_name_fields_Test_thumb.png" width="653" height="336" />
          </a>
        </p>
        <h4>Installing IIS Manager for Remote Administration
</h4>
        <p>
The process for deploying to production is similar except that you create the package
using the Release build configuration, and you install it in <strong>IIS Manager</strong> using
a remote connection to the hosting provider. But first you have to install the <strong>IIS
Manager</strong> feature that facilitates remote connections.
</p>
        <p>
Click the following link to use the Web Platform Installer for this task:
</p>
        <ul>
          <li>
            <a href="http://go.microsoft.com/?linkid=9655670">IIS Manager for Remote Administration
v1.1</a>
          </li>
        </ul>
        <h4>Connecting to Your Site at the Hosting Provider
</h4>
        <p>
After you install the <strong>IIS Manager for Remote Administration</strong>, run <strong>IIS
Manager</strong>. You see a new <strong>Start Page</strong> in <strong>IIS Manager</strong> that
has several <strong>Connect to ...</strong> links in a <strong>Connection tasks</strong> box.
(These options are also available from the <strong>File</strong> menu.)
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/IIS_Manager_Remote_Admin_Start_Page_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="IIS_Manager_Remote_Admin_Start_Page" border="0" alt="IIS_Manager_Remote_Admin_Start_Page" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/IIS_Manager_Remote_Admin_Start_Page_thumb.png" width="628" height="413" />
          </a>
        </p>
        <p>
In <strong>IIS Manager</strong>, click <strong>Connect to a site</strong>. In the <strong>Specify
Site Connection Details</strong> step, enter the <strong>Server name</strong> and <strong>Site
name</strong> values that are assigned to you by your provider, and then click <strong>Next</strong>.
For a hosting account at Cytanium.com, you get the server name from <strong>Service
URL</strong> in the Visual Studio 2010 section of the welcome email. The site name
is indicated by "Site/application" in the same section of the email. 
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Specify_Site_Connection_Details_dialog_box_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="Specify_Site_Connection_Details_dialog_box" border="0" alt="Specify_Site_Connection_Details_dialog_box" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Specify_Site_Connection_Details_dialog_box_thumb.png" width="650" height="500" />
          </a>
        </p>
        <p>
In the <strong>Provide Credentials</strong> step, enter the user name and password
assigned by the provider, and then click <strong>Next</strong>:
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Provide_Credentials_dialog_box_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="Provide_Credentials_dialog_box" border="0" alt="Provide_Credentials_dialog_box" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Provide_Credentials_dialog_box_thumb.png" width="650" height="500" />
          </a>
        </p>
        <p>
You might see a <strong>Server Certificate Alert</strong> dialog box. If you're sure
that you've entered the correct server and site name, click <strong>Connect</strong>.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Server_Certificate_Alert_dialog_box_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="Server_Certificate_Alert_dialog_box" border="0" alt="Server_Certificate_Alert_dialog_box" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Server_Certificate_Alert_dialog_box_thumb.png" width="402" height="289" />
          </a>
        </p>
        <p>
In the <strong>Specify a Connection Name</strong> step, click <strong>Finish</strong>.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Specify_a_Connection_Name_dialog_box_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="Specify_a_Connection_Name_dialog_box" border="0" alt="Specify_a_Connection_Name_dialog_box" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Specify_a_Connection_Name_dialog_box_thumb.png" width="650" height="500" />
          </a>
        </p>
        <p>
After <strong>IIS Manager</strong> connects to the provider's server, a <strong>New
Feature Available</strong> dialog box might appear that lists administration features
available for download. Click <strong>Cancel</strong> — you've already installed everything
you need for this deployment.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/New_Feature_Available_dialog_box_Cytanium_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="New_Feature_Available_dialog_box_Cytanium" border="0" alt="New_Feature_Available_dialog_box_Cytanium" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/New_Feature_Available_dialog_box_Cytanium_thumb.png" width="610" height="419" />
          </a>
        </p>
        <p>
After the <strong>New Feature Available</strong> box closes, the <strong>IIS Manager</strong> window
appears. There's now a node in the <strong>Connections</strong> pane for the site
at the hosting provider.
</p>
        <h4>Creating a Package for the Production Site
</h4>
        <p>
The next step is to create a deployment package for the production environment. In
the Visual Studio <strong>Solution Configurations</strong> drop-down box, select the
Release build configuration.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Solution_Configurations_dropdown_Release_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="Solution_Configurations_dropdown_Release" border="0" alt="Solution_Configurations_dropdown_Release" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Solution_Configurations_dropdown_Release_thumb.png" width="554" height="93" />
          </a>
        </p>
        <p>
In <strong>Solution Explorer</strong>, right-click the <strong>ContosoUniversity</strong> project
and then select <strong>Build Deployment Package</strong>.
</p>
        <p>
The <strong>Output</strong> window reports a successful build and publish (package
creation), and it tells you that the package is created in the <em>obj\Release\Package</em> folder
in your project folder.
</p>
        <h4>Installing the Package in the Production Environment
</h4>
        <p>
Now you can install the package in the production environment. In the <strong>IIS
Manager</strong><strong>Connections</strong> pane, select the new connection you
added earlier. Then click <strong>Import Application</strong>, which will walk you
through the same process you followed earlier when you deployed to the test environment. 
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/IIS_Manager_with_provider_site_selected_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="IIS_Manager_with_provider_site_selected" border="0" alt="IIS_Manager_with_provider_site_selected" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/IIS_Manager_with_provider_site_selected_thumb.png" width="646" height="521" />
          </a>
        </p>
        <p>
In the <strong>Select the Package</strong> step, select the package that you just
created:
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Select_the_Package_dialog_box_Prod_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="Select_the_Package_dialog_box_Prod" border="0" alt="Select_the_Package_dialog_box_Prod" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Select_the_Package_dialog_box_Prod_thumb.png" width="650" height="500" />
          </a>
        </p>
        <p>
In the <strong>Select the Contents of the Package</strong> step, leave all the check
boxes selected and click <strong>Next</strong>:
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Select_the_Contents_of_the_Package_dialog_box_Prod_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="Select_the_Contents_of_the_Package_dialog_box_Prod" border="0" alt="Select_the_Contents_of_the_Package_dialog_box_Prod" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Select_the_Contents_of_the_Package_dialog_box_Prod_thumb.png" width="650" height="500" />
          </a>
        </p>
        <p>
In the <strong>Enter Application Package Information</strong> step, clear the <strong>Application
Path</strong> and click <strong>Next</strong>:
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Enter_Application_Package_Information_dialog_box_Prod_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="Enter_Application_Package_Information_dialog_box_Prod" border="0" alt="Enter_Application_Package_Information_dialog_box_Prod" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Enter_Application_Package_Information_dialog_box_Prod_thumb.png" width="641" height="491" />
          </a>
        </p>
        <p>
The wizard asks if you want to delete files at the destination that aren't in the
source. 
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Overwrite_Existing_Files_dialog_box_4.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="Overwrite_Existing_Files_dialog_box" border="0" alt="Overwrite_Existing_Files_dialog_box" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Overwrite_Existing_Files_dialog_box_thumb_1.png" width="650" height="500" />
          </a>
        </p>
        <p>
You don't need to have anything deleted, so just click <strong>Next</strong>. 
</p>
        <p>
When you get the warning about installing to the root folder, click <strong>OK</strong>:
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Installation_in_root_folder_warning_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="Installation_in_root_folder_warning" border="0" alt="Installation_in_root_folder_warning" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Installation_in_root_folder_warning_thumb.png" width="530" height="219" />
          </a>
        </p>
        <p>
Package installation begins. When it's done, the <strong>Installation Progress and
Summary</strong> dialog box is shown:
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Installation_Progress_and_Summary_dialog_box_4.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="Installation_Progress_and_Summary_dialog_box" border="0" alt="Installation_Progress_and_Summary_dialog_box" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Installation_Progress_and_Summary_dialog_box_thumb_1.png" width="650" height="500" />
          </a>
        </p>
        <p>
Click <strong>Finish</strong>. Your application has been deployed to the hosting provider's
server, and you can test by browsing to your public site's URL.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Instructors_page_with_separate_name_fields_Prod_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="Instructors_page_with_separate_name_fields_Prod" border="0" alt="Instructors_page_with_separate_name_fields_Prod" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Instructors_page_with_separate_name_fields_Prod_thumb.png" width="616" height="294" />
          </a>
        </p>
        <p>
You've now seen how to deploy an application update by manually creating and installing
a deployment package. For information about how to create and install packages from
the command line in order to be able to integrate them into a continuous integration
process, see the <a href="http://msdn.microsoft.com/en-us/library/bb386521.aspx">ASP.NET
Deployment Content Map</a> on the MSDN web site.
</p>
        <p>
Sayed Ibrahim Hashimi – <a href="http://twitter.com/#!/sayedihashimi" target="_blank">@SayedIHashimi</a></p>
        <p>
ddd
</p>
      </body>
      <title>Using a Web Deploy package to deploy to IIS on the dev box and to a third party host</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,7b98b9ee-5391-4ba5-9f64-bcbbe815035c.aspx</guid>
      <link>http://sedodream.com/2011/11/08/UsingAWebDeployPackageToDeployToIISOnTheDevBoxAndToAThirdPartyHost.aspx</link>
      <pubDate>Tue, 08 Nov 2011 05:11:43 GMT</pubDate>
      <description>&lt;p&gt;
&lt;em&gt;Note: I’d like to thank Tom Dykstra for helping me put this together&lt;/em&gt;
&lt;/p&gt;
&lt;h3&gt;Overview
&lt;/h3&gt;
&lt;p&gt;
In this tutorial you'll see how to use a &lt;em&gt;web deployment package&lt;/em&gt; package to
deploy an application. A deployment package is a &lt;em&gt;.zip&lt;/em&gt; file that includes
all of the content and metadata that's required to deploy an application. 
&lt;/p&gt;
&lt;p&gt;
Deployment packages are often used in enterprise environments. This is because a developer
or a continuous integration server can create the package without needing to know
things like passwords that are stored in &lt;em&gt;Web.config&lt;/em&gt; files. Only the server
administrator who actually installs the package needs to know those passwords, and
that person can enter the details at installation time.
&lt;/p&gt;
&lt;p&gt;
In a smaller organization that doesn't have separate people for these roles, there's
less need for deployment packages. But you can also use deployment packages as a way
to back up and restore the state of an application. After you use a deployment package
to deploy, you can save the package,. Then if a subsequent deployment has a problem,
you can quickly and easily restore the application state to the earlier state by reinstalling
the earlier package. (This scenario is more complicated if database changes are involved,
however.)
&lt;/p&gt;
&lt;p&gt;
This tutorial shows how to use Visual Studio to create a package and IIS Manager to
install it. For information about how to create and install packages using the command
line, see &lt;a href="http://msdn.microsoft.com/en-us/library/bb386521.aspx"&gt;ASP.NET
Deployment Content Map&lt;/a&gt; on the MSDN web site.
&lt;/p&gt;
&lt;p&gt;
To keep things relatively simple, this example assumes you have already deployed the
application and its databases, and you only need to deploy a code update. You have
made the code update, and you are ready to deploy it first to your test environment
(IIS on your local computer) and then to your hosting provider. You have a Test build
configuration that you use for the test environment and you use the Release build
configuration for the production environment. In the example, the name of the Visual
Studio project is ContosoUniversity, and instructions for its initial deployment can
be found in a series of tutorials that will be published in December on the ASP.NET
web site. 
&lt;/p&gt;
&lt;p&gt;
The hosting provider shown, Cytanium.com, is one of many that are available, and its
use here does not constitute an endorsement or recommendation.
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;strong&gt;Note&lt;/strong&gt; The following example uses separate packages for the test and
production environments, but you can also create a single deployment package that
can be used for both environments. This would require that you use Web Deploy parameters
instead of &lt;em&gt;Web.config&lt;/em&gt; transformations for &lt;em&gt;Web.config&lt;/em&gt; file changes
that depend on deployment destination. For information about how to use Web Deploy
parameters, see &lt;a href="http://msdn.microsoft.com/en-us/library/ff398068.aspx"&gt;How
to: Use Parameters to Configure Deployment Settings When a Package is Installed&lt;/a&gt;.
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;h3&gt;Configuring the Deployment Package
&lt;/h3&gt;
&lt;p&gt;
In this section, you'll configure settings for the deployment package. Some of these
settings are the same ones that you set also for one-click publish, others are only
for deployment packages. 
&lt;/p&gt;
&lt;p&gt;
Open the &lt;strong&gt;Package/Publish Web&lt;/strong&gt; tab of the &lt;strong&gt;Project Properties&lt;/strong&gt; window
and select the &lt;strong&gt;Test&lt;/strong&gt; build configuration.
&lt;/p&gt;
&lt;p&gt;
For this deployment you aren't making any database changes, so clear &lt;strong&gt;Include
all databases configured in Package/Publish SQL tab&lt;/strong&gt;. Make sure &lt;strong&gt;Exclude
files from the App_Data folder&lt;/strong&gt; is selected.
&lt;/p&gt;
&lt;p&gt;
Review the settings in the section labeled &lt;strong&gt;Web Deployment Package Settings&lt;/strong&gt;:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
By default, deployment packages are created as &lt;em&gt;.zip&lt;/em&gt; files. You don't need
to change this setting. 
&lt;/li&gt;
&lt;li&gt;
By default, deployment packages are created in the project's &lt;em&gt;obj\Test\Package&lt;/em&gt; folder.
You don't need to change this setting. 
&lt;/li&gt;
&lt;li&gt;
The default IIS web application name is the name of the project with &amp;quot;_deploy&amp;quot;
appended to it. Remove that suffix. You want the application to be named just ContosoUniversity
in IIS on your computer. 
&lt;/li&gt;
&lt;li&gt;
For this tutorial you're not deploying IIS settings, so you don't need to enter a
password for that. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The &lt;strong&gt;Package/Publish Web&lt;/strong&gt; tab now looks like this:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Package_Publish_Web_tab_Test_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="Package_Publish_Web_tab_Test" border="0" alt="Package_Publish_Web_tab_Test" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Package_Publish_Web_tab_Test_thumb.png" width="632" height="767" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
You also need to configure settings for deploying to the production environment. Select
the &lt;strong&gt;Release&lt;/strong&gt; build configuration to do that.
&lt;/p&gt;
&lt;p&gt;
Change &lt;strong&gt;IIS Web site/application name to use on the destination server&lt;/strong&gt; to
a string that will serve as a reminder of what you need to do later when this value
is displayed in the IIS Manager UI: &amp;quot;[clear this field]&amp;quot;. The text box on
this page won't stay cleared even if you clear it, so entering this note to yourself
will remind you to clear this value later when you deploy. When you deploy to your
hosting provider, you will connect to a site, not to a server, and in this case you
want to deploy to the root of the site.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Package_Publish_Web_tab_Release_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="Package_Publish_Web_tab_Release" border="0" alt="Package_Publish_Web_tab_Release" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Package_Publish_Web_tab_Release_thumb.png" width="634" height="769" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;h4&gt;Creating a Deployment Package for the Test Environment
&lt;/h4&gt;
&lt;p&gt;
To create a deployment package, first make sure you've selected the right build configuration.
In the &lt;strong&gt;Solution Configurations&lt;/strong&gt; drop-down box, select &lt;strong&gt;Test&lt;/strong&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Solution_Configurations_dropdown_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="Solution_Configurations_dropdown" border="0" alt="Solution_Configurations_dropdown" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Solution_Configurations_dropdown_thumb.png" width="559" height="95" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
In &lt;strong&gt;Solution Explorer&lt;/strong&gt;, right-click the project that you want to build
the package for and then select &lt;strong&gt;Build Deployment Package&lt;/strong&gt;.
&lt;/p&gt;
&lt;p&gt;
The &lt;strong&gt;Output&lt;/strong&gt; window reports successful a build and publish (package
creation) and tells you where the package was created.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Output_Window_package_creation_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="Output_Window_package_creation" border="0" alt="Output_Window_package_creation" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Output_Window_package_creation_thumb.png" width="653" height="228" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;h4&gt;Installing the Deployment Package in the Test Environment
&lt;/h4&gt;
&lt;p&gt;
The next step is to install the deployment package in IIS on your development computer. 
&lt;/p&gt;
&lt;p&gt;
Run &lt;strong&gt;IIS Manager&lt;/strong&gt;. In the &lt;strong&gt;Connections&lt;/strong&gt; pane of the &lt;strong&gt;IIS
Manager&lt;/strong&gt; window, expand the local server node, expand the &lt;strong&gt;Sites&lt;/strong&gt; node,
and select &lt;strong&gt;Default Web Site&lt;/strong&gt;. Then in the &lt;strong&gt;Actions&lt;/strong&gt; pane,
click &lt;strong&gt;Import Application&lt;/strong&gt;. (If you don't see an &lt;strong&gt;Import Application&lt;/strong&gt; link,
the most likely reason is that you have not installed Web Deploy. You can use the &lt;a href="http://www.microsoft.com/web/downloads/platform.aspx"&gt;Web
Platform Installer&lt;/a&gt; to install both IIS and Web Deploy.)
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Default_Web_Site_in_inetmgr_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="Default_Web_Site_in_inetmgr" border="0" alt="Default_Web_Site_in_inetmgr" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Default_Web_Site_in_inetmgr_thumb.png" width="607" height="464" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
In the &lt;strong&gt;Select the Package&lt;/strong&gt; wizard step, navigate to the location of
the package you just created. By default, that's the &lt;em&gt;obj\Test\Package&lt;/em&gt; folder
in your ContosoUniversity project folder. (A package created with the &lt;strong&gt;Release&lt;/strong&gt; build
configuration would be in &lt;em&gt;obj\Release\Package&lt;/em&gt;.)
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Select_the_Package_dialog_box_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="Select_the_Package_dialog_box" border="0" alt="Select_the_Package_dialog_box" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Select_the_Package_dialog_box_thumb.png" width="650" height="500" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Click &lt;strong&gt;Next&lt;/strong&gt;. The &lt;strong&gt;Select the Contents of the Package&lt;/strong&gt; step
is displayed.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Select_the_Contents_of_the_Package_dialog_box_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="Select_the_Contents_of_the_Package_dialog_box" border="0" alt="Select_the_Contents_of_the_Package_dialog_box" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Select_the_Contents_of_the_Package_dialog_box_thumb.png" width="650" height="500" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Click &lt;strong&gt;Next&lt;/strong&gt;. 
&lt;/p&gt;
&lt;p&gt;
The step that allows you to enter parameter values is displayed. The &lt;strong&gt;Application
Path&lt;/strong&gt; value defaults to &amp;quot;ContosoUniversity&amp;quot;, because that's what
you entered on the &lt;strong&gt;Package/Publish Web&lt;/strong&gt; tab of the &lt;strong&gt;Project
Properties&lt;/strong&gt; window.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Enter_Application_Package_Information_dialog_box_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="Enter_Application_Package_Information_dialog_box" border="0" alt="Enter_Application_Package_Information_dialog_box" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Enter_Application_Package_Information_dialog_box_thumb.png" width="650" height="500" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Click &lt;strong&gt;Next&lt;/strong&gt;. 
&lt;/p&gt;
&lt;p&gt;
The wizard asks if you want to delete files at the destination that aren't in the
source. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Overwrite_Existing_Files_dialog_box_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="Overwrite_Existing_Files_dialog_box" border="0" alt="Overwrite_Existing_Files_dialog_box" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Overwrite_Existing_Files_dialog_box_thumb.png" width="650" height="500" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
In this case you haven't deleted any files that you want to delete at the destination,
so the default (no deletions) is okay. Click &lt;strong&gt;Next&lt;/strong&gt;. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;IIS Manager&lt;/strong&gt; installs the package and reports its status.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Installation_Progress_and_Summary_dialog_box_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="Installation_Progress_and_Summary_dialog_box" border="0" alt="Installation_Progress_and_Summary_dialog_box" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Installation_Progress_and_Summary_dialog_box_thumb.png" width="650" height="500" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Click &lt;strong&gt;Finish&lt;/strong&gt;. 
&lt;/p&gt;
&lt;p&gt;
Open a browser and run the application in test by going to the URL &lt;code&gt;&lt;a href="http://localhost/ContosoUniversity"&gt;http://localhost/ContosoUniversity&lt;/a&gt;&lt;/code&gt;. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Instructors_page_with_separate_name_fields_Test_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="Instructors_page_with_separate_name_fields_Test" border="0" alt="Instructors_page_with_separate_name_fields_Test" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Instructors_page_with_separate_name_fields_Test_thumb.png" width="653" height="336" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;h4&gt;Installing IIS Manager for Remote Administration
&lt;/h4&gt;
&lt;p&gt;
The process for deploying to production is similar except that you create the package
using the Release build configuration, and you install it in &lt;strong&gt;IIS Manager&lt;/strong&gt; using
a remote connection to the hosting provider. But first you have to install the &lt;strong&gt;IIS
Manager&lt;/strong&gt; feature that facilitates remote connections.
&lt;/p&gt;
&lt;p&gt;
Click the following link to use the Web Platform Installer for this task:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://go.microsoft.com/?linkid=9655670"&gt;IIS Manager for Remote Administration
v1.1&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;Connecting to Your Site at the Hosting Provider
&lt;/h4&gt;
&lt;p&gt;
After you install the &lt;strong&gt;IIS Manager for Remote Administration&lt;/strong&gt;, run &lt;strong&gt;IIS
Manager&lt;/strong&gt;. You see a new &lt;strong&gt;Start Page&lt;/strong&gt; in &lt;strong&gt;IIS Manager&lt;/strong&gt; that
has several &lt;strong&gt;Connect to ...&lt;/strong&gt; links in a &lt;strong&gt;Connection tasks&lt;/strong&gt; box.
(These options are also available from the &lt;strong&gt;File&lt;/strong&gt; menu.)
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/IIS_Manager_Remote_Admin_Start_Page_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="IIS_Manager_Remote_Admin_Start_Page" border="0" alt="IIS_Manager_Remote_Admin_Start_Page" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/IIS_Manager_Remote_Admin_Start_Page_thumb.png" width="628" height="413" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
In &lt;strong&gt;IIS Manager&lt;/strong&gt;, click &lt;strong&gt;Connect to a site&lt;/strong&gt;. In the &lt;strong&gt;Specify
Site Connection Details&lt;/strong&gt; step, enter the &lt;strong&gt;Server name&lt;/strong&gt; and &lt;strong&gt;Site
name&lt;/strong&gt; values that are assigned to you by your provider, and then click &lt;strong&gt;Next&lt;/strong&gt;.
For a hosting account at Cytanium.com, you get the server name from &lt;strong&gt;Service
URL&lt;/strong&gt; in the Visual Studio 2010 section of the welcome email. The site name
is indicated by &amp;quot;Site/application&amp;quot; in the same section of the email. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Specify_Site_Connection_Details_dialog_box_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="Specify_Site_Connection_Details_dialog_box" border="0" alt="Specify_Site_Connection_Details_dialog_box" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Specify_Site_Connection_Details_dialog_box_thumb.png" width="650" height="500" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
In the &lt;strong&gt;Provide Credentials&lt;/strong&gt; step, enter the user name and password
assigned by the provider, and then click &lt;strong&gt;Next&lt;/strong&gt;:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Provide_Credentials_dialog_box_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="Provide_Credentials_dialog_box" border="0" alt="Provide_Credentials_dialog_box" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Provide_Credentials_dialog_box_thumb.png" width="650" height="500" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
You might see a &lt;strong&gt;Server Certificate Alert&lt;/strong&gt; dialog box. If you're sure
that you've entered the correct server and site name, click &lt;strong&gt;Connect&lt;/strong&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Server_Certificate_Alert_dialog_box_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="Server_Certificate_Alert_dialog_box" border="0" alt="Server_Certificate_Alert_dialog_box" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Server_Certificate_Alert_dialog_box_thumb.png" width="402" height="289" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
In the &lt;strong&gt;Specify a Connection Name&lt;/strong&gt; step, click &lt;strong&gt;Finish&lt;/strong&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Specify_a_Connection_Name_dialog_box_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="Specify_a_Connection_Name_dialog_box" border="0" alt="Specify_a_Connection_Name_dialog_box" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Specify_a_Connection_Name_dialog_box_thumb.png" width="650" height="500" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
After &lt;strong&gt;IIS Manager&lt;/strong&gt; connects to the provider's server, a &lt;strong&gt;New
Feature Available&lt;/strong&gt; dialog box might appear that lists administration features
available for download. Click &lt;strong&gt;Cancel&lt;/strong&gt; — you've already installed everything
you need for this deployment.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/New_Feature_Available_dialog_box_Cytanium_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="New_Feature_Available_dialog_box_Cytanium" border="0" alt="New_Feature_Available_dialog_box_Cytanium" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/New_Feature_Available_dialog_box_Cytanium_thumb.png" width="610" height="419" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
After the &lt;strong&gt;New Feature Available&lt;/strong&gt; box closes, the &lt;strong&gt;IIS Manager&lt;/strong&gt; window
appears. There's now a node in the &lt;strong&gt;Connections&lt;/strong&gt; pane for the site
at the hosting provider.
&lt;/p&gt;
&lt;h4&gt;Creating a Package for the Production Site
&lt;/h4&gt;
&lt;p&gt;
The next step is to create a deployment package for the production environment. In
the Visual Studio &lt;strong&gt;Solution Configurations&lt;/strong&gt; drop-down box, select the
Release build configuration.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Solution_Configurations_dropdown_Release_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="Solution_Configurations_dropdown_Release" border="0" alt="Solution_Configurations_dropdown_Release" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Solution_Configurations_dropdown_Release_thumb.png" width="554" height="93" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
In &lt;strong&gt;Solution Explorer&lt;/strong&gt;, right-click the &lt;strong&gt;ContosoUniversity&lt;/strong&gt; project
and then select &lt;strong&gt;Build Deployment Package&lt;/strong&gt;.
&lt;/p&gt;
&lt;p&gt;
The &lt;strong&gt;Output&lt;/strong&gt; window reports a successful build and publish (package
creation), and it tells you that the package is created in the &lt;em&gt;obj\Release\Package&lt;/em&gt; folder
in your project folder.
&lt;/p&gt;
&lt;h4&gt;Installing the Package in the Production Environment
&lt;/h4&gt;
&lt;p&gt;
Now you can install the package in the production environment. In the &lt;strong&gt;IIS
Manager&lt;/strong&gt; &lt;strong&gt;Connections&lt;/strong&gt; pane, select the new connection you
added earlier. Then click &lt;strong&gt;Import Application&lt;/strong&gt;, which will walk you
through the same process you followed earlier when you deployed to the test environment. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/IIS_Manager_with_provider_site_selected_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="IIS_Manager_with_provider_site_selected" border="0" alt="IIS_Manager_with_provider_site_selected" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/IIS_Manager_with_provider_site_selected_thumb.png" width="646" height="521" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
In the &lt;strong&gt;Select the Package&lt;/strong&gt; step, select the package that you just
created:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Select_the_Package_dialog_box_Prod_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="Select_the_Package_dialog_box_Prod" border="0" alt="Select_the_Package_dialog_box_Prod" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Select_the_Package_dialog_box_Prod_thumb.png" width="650" height="500" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
In the &lt;strong&gt;Select the Contents of the Package&lt;/strong&gt; step, leave all the check
boxes selected and click &lt;strong&gt;Next&lt;/strong&gt;:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Select_the_Contents_of_the_Package_dialog_box_Prod_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="Select_the_Contents_of_the_Package_dialog_box_Prod" border="0" alt="Select_the_Contents_of_the_Package_dialog_box_Prod" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Select_the_Contents_of_the_Package_dialog_box_Prod_thumb.png" width="650" height="500" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
In the &lt;strong&gt;Enter Application Package Information&lt;/strong&gt; step, clear the &lt;strong&gt;Application
Path&lt;/strong&gt; and click &lt;strong&gt;Next&lt;/strong&gt;:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Enter_Application_Package_Information_dialog_box_Prod_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="Enter_Application_Package_Information_dialog_box_Prod" border="0" alt="Enter_Application_Package_Information_dialog_box_Prod" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Enter_Application_Package_Information_dialog_box_Prod_thumb.png" width="641" height="491" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
The wizard asks if you want to delete files at the destination that aren't in the
source. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Overwrite_Existing_Files_dialog_box_4.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="Overwrite_Existing_Files_dialog_box" border="0" alt="Overwrite_Existing_Files_dialog_box" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Overwrite_Existing_Files_dialog_box_thumb_1.png" width="650" height="500" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
You don't need to have anything deleted, so just click &lt;strong&gt;Next&lt;/strong&gt;. 
&lt;/p&gt;
&lt;p&gt;
When you get the warning about installing to the root folder, click &lt;strong&gt;OK&lt;/strong&gt;:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Installation_in_root_folder_warning_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="Installation_in_root_folder_warning" border="0" alt="Installation_in_root_folder_warning" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Installation_in_root_folder_warning_thumb.png" width="530" height="219" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Package installation begins. When it's done, the &lt;strong&gt;Installation Progress and
Summary&lt;/strong&gt; dialog box is shown:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Installation_Progress_and_Summary_dialog_box_4.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="Installation_Progress_and_Summary_dialog_box" border="0" alt="Installation_Progress_and_Summary_dialog_box" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Installation_Progress_and_Summary_dialog_box_thumb_1.png" width="650" height="500" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Click &lt;strong&gt;Finish&lt;/strong&gt;. Your application has been deployed to the hosting provider's
server, and you can test by browsing to your public site's URL.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Instructors_page_with_separate_name_fields_Prod_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="Instructors_page_with_separate_name_fields_Prod" border="0" alt="Instructors_page_with_separate_name_fields_Prod" src="http://sedodream.com/content/binary/Windows-Live-Writer/b763f270a538_125B5/Instructors_page_with_separate_name_fields_Prod_thumb.png" width="616" height="294" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
You've now seen how to deploy an application update by manually creating and installing
a deployment package. For information about how to create and install packages from
the command line in order to be able to integrate them into a continuous integration
process, see the &lt;a href="http://msdn.microsoft.com/en-us/library/bb386521.aspx"&gt;ASP.NET
Deployment Content Map&lt;/a&gt; on the MSDN web site.
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi – &lt;a href="http://twitter.com/#!/sayedihashimi" target="_blank"&gt;@SayedIHashimi&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
ddd
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,7b98b9ee-5391-4ba5-9f64-bcbbe815035c.aspx</comments>
      <category>IIS</category>
      <category>MSBuild</category>
      <category>MSDeploy</category>
      <category>web</category>
      <category>Web Deployment Tool</category>
      <category>Web Development</category>
      <category>Web Publishing Pipeline</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=487f5f26-2d6f-4deb-9d5d-24b500cab3ff</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,487f5f26-2d6f-4deb-9d5d-24b500cab3ff.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,487f5f26-2d6f-4deb-9d5d-24b500cab3ff.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=487f5f26-2d6f-4deb-9d5d-24b500cab3ff</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <title>How to compress CSS/JavaScript before publish/package</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,487f5f26-2d6f-4deb-9d5d-24b500cab3ff.aspx</guid>
      <link>http://sedodream.com/2011/02/25/HowToCompressCSSJavaScriptBeforePublishpackage.aspx</link>
      <pubDate>Fri, 25 Feb 2011 05:21:44 GMT</pubDate>
      <description>&lt;p&gt;
Today I saw a post on stackoverflow.com asking &lt;a href="http://stackoverflow.com/q/5043504/105999" target="_blank"&gt;Using
Microsoft AJAX Minifier with Visual Studio 2010 1-click publish&lt;/a&gt;. This is a response
to that question. The Web Publishing Pipeline is pretty extensive so it is easy for
us to hook in to it in order to perform operation such as these. One of those extension
points, as we’ve blogged about before, is creating a .wpp.targets file. If you create
a file in the same directory of your project with the name {ProjectName}.wpp.targets
then that file will automatically be imported and included in the build/publish process.
This makes it easy to edit your build/publish process without always having to edit
the project file itself. I will use this technique to demonstrate how to compress
the CSS &amp; JavaScript files a project contains before it is published/packaged.
&lt;/p&gt;
&lt;p&gt;
Eventhough the question specifically states Microsoft AJAX Minifier I decided to use
the compressor contained in Packer.NET (link in resources section). I did this because
when I looked at the MSBuild task for the AJAX Minifier it didn’t look like I could
control the output location of the compressed files. Instead it would simply write
to the same folder with an extension like .min.cs or .min.js. In any case, when you
publish/package your Web Application Project (WAP) the files are copied to a temporary
location before the publish/package occurs. The default value for this location is
obj\{Configuration}\Package\PackageTmp\ where {Configuration} is the build configuration
that you are currently using for your WAP. So what we need to do is to allow the WPP
to copy all the files to that location and then after that we can compress the CSS
and JavaScript that goes in that folder. The target which copies the files to that
location is &lt;strong&gt;CopyAllFilesToSingleFolderForPackage&lt;/strong&gt;. (To learn more
about these targets take a look at the file %Program Files (x86)%\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets.)
To make our target run after this target we can use the MSBuild AfterTargets attribute.
The project that I created to demonstrate this is called CompressBeforePublish, because
of that I create a new file named CompressBeforePublish.wpp.targets to contain my
changes.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;
&lt;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
&lt;UsingTask taskname="SmallSharpTools.Packer.MSBuild.Packer" assemblyfile="$(MSBuildThisFileDirectory)..\Contrib\SmallSharpTools.Packer\SmallSharpTools.Packer.dll" /&gt;
&lt;!-- This target will run after the files are copied to PackageTmp folder --&gt;
&lt;Target name="CompressJsAndCss" aftertargets="CopyAllFilesToSingleFolderForPackage"&gt;
&lt;!-- Discover files to compress --&gt;
&lt;ItemGroup&gt;
&lt;_JavaScriptFiles include="$(_PackageTempDir)\Scripts\**\*.js" /&gt;
&lt;_CssFiles include="$(_PackageTempDir)\Content\**\*.css" /&gt;
&lt;/ItemGroup&gt;
&lt;Message text="Compressing JavaScript files" importance="high" /&gt;
&lt;!-- 
      Compress the JavaScript files. 
      Not the usage of %(JavaScript.Identity which causes this task to run once per
      .js file in the JavaScriptFiles item list.
      For more info on batching: http://sedotech.com/resources#Batching
    --&gt;
&lt;Packer inputfiles="%(_JavaScriptFiles.Identity)" outputfilename="@(_JavaScriptFiles-&gt;'$(_PackageTempDir)\Scripts\%(RecursiveDir)%(Filename)%(Extension)')" mode="JSMin" verbose="false" condition=" '@(_JavaScriptFiles)' != ''" /&gt;
&lt;Message text="Compressing CSS files" importance="high" /&gt;
&lt;Packer inputfiles="%(_CssFiles.Identity)" outputfilename="@(_CssFiles-&gt;'$(_PackageTempDir)\Content\%(RecursiveDir)%(Filename)%(Extension)')" mode="CSSMin" verbose="false" condition=" '@(_CssFiles)' != '' " /&gt;
&lt;/Target&gt;
&lt;/Project&gt;
&lt;/pre&gt;
&lt;p&gt;
Here I’ve created one target, CompressJsAndCss, and I have included AfterTargets=”CopyAllFilesToSingleFolderForPackage”
which causes it to be executed after CopyAllFilesToSingleFolderForPackage. Inside
this target I do two things, gather the files which need to be compressed and then
I compress them.
&lt;/p&gt;
&lt;h5&gt;1. Gather files to be compressed
&lt;/h5&gt;
&lt;pre class="brush: xml;"&gt;
&lt;ItemGroup&gt;
&lt;_JavaScriptFiles include="$(_PackageTempDir)\Scripts\**\*.js" /&gt;
&lt;_CssFiles include="$(_PackageTempDir)\Content\**\*.css" /&gt;
&lt;/ItemGroup&gt;
&lt;/pre&gt;
&lt;p&gt;
Here I use an item list for both JavaScript files as well as CSS files. Notice that
I am using the _PackageTempDir property to pickup .js &amp; .css files inside the temporary
folder where the files are written to be packaged. The reason that I’m doing that
instead of picking up source files is because my build may be outputting other .js
&amp; .css files and which are going to be published. &lt;em&gt;Note: since the property _PackageTempDir
starts with an underscore it is not guaranteed to behave (or even exist) in future
versions&lt;/em&gt;.
&lt;/p&gt;
&lt;h5&gt;2. Compress files
&lt;/h5&gt;
&lt;p&gt;
I use the Packer task to compress the .js and .css files. For both sets of files the
usage is pretty similar so I will only look at the first usage.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;
&lt;Packer inputfiles="%(_JavaScriptFiles.Identity)" outputfilename="@(_JavaScriptFiles-&gt;'$(_PackageTempDir)\Scripts\%(RecursiveDir)%(Filename)%(Extension)')" mode="JSMin" verbose="false" condition=" '@(_JavaScriptFiles)' != ''" /&gt;
&lt;/pre&gt;
&lt;p&gt;
Here the task is fed all the .js files for compression. Take a note how I passed the
files into the task using, %(_JavaScriptFiles.Identity), in this case what that does
is to cause this task to be executed once per .js file. &lt;em&gt;The %(abc.def) syntax
invokes batching, if you are not familiar with batching please see below.&lt;/em&gt; For
the value of the output file I use the _PackageTempDir property again. In this case
since the item already resides there I could have simplified that to be @(_JavaScriptFiles-&gt;’%(FullPath)’)
but I thought you might find that expression helpful in the case that you are compressing
files which do not already exist in the _PackageTempDir folder.
&lt;/p&gt;
&lt;p&gt;
Now that we have added this target to the .wpp.targets file we can publish/package
our web project and it the contained .js &amp; .css files will be compressed. &lt;em&gt;Note:
Whenever you modify the .wpp.targets file you will have to unload/reload the web project
so that the changes are picked up, Visual Studio caches your projects.&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
In the image below you can see the difference that compressing these files made.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/How-to-compress-CSSJavaScript-before-pub_13DD2/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/How-to-compress-CSSJavaScript-before-pub_13DD2/image_thumb.png" width="738" height="416" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
You can download the entire project below, as well as take a look at some other resources
that I have that you might be interested in.
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi
&lt;/p&gt;
&lt;h5&gt;Resources
&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://sedotech.com/content/samples/CompressBeforePublish.zip"&gt;http://sedotech.com/content/samples/CompressBeforePublish.zip&lt;/a&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;a title="http://sedotech.com/resources#batching" href="http://sedotech.com/resources#batching"&gt;http://sedotech.com/resources#batching&lt;/a&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://freetodev.wordpress.com/2009/06/24/msbuild-4-0-beforetargets-and-aftertargets/" target="_blank"&gt;MSBuild
BeforeTargets/AfterTargets&lt;/a&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;a title="http://sedodream.com/2010/08/15/WebDeploymentToolMSDeployHowToExcludeFilesFromPackageBasedOnConfiguration.aspx" href="http://sedodream.com/2010/08/15/WebDeploymentToolMSDeployHowToExcludeFilesFromPackageBasedOnConfiguration.aspx"&gt;•Web
Deploy: How to exclude files from package based on Configuration&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://svn.offwhite.net/trac/SmallSharpTools.Packer/" target="_blank"&gt;Packer.NET&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,487f5f26-2d6f-4deb-9d5d-24b500cab3ff.aspx</comments>
      <category>Deployment</category>
      <category>MSDeploy</category>
      <category>Web Publishing Pipeline</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=d158f2b8-cdee-4257-86cd-401362deeff2</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,d158f2b8-cdee-4257-86cd-401362deeff2.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,d158f2b8-cdee-4257-86cd-401362deeff2.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=d158f2b8-cdee-4257-86cd-401362deeff2</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Back in November I participated in <a href="http://virtualtechdays.com/">Virtual Tech
Days</a> which is an online conference presented by Microsoft. In the session I discussed
the enhancements to web deployment using Visual Studio 2010 and MSDeploy. Some of
the topics which I covered includ:
</p>
        <ul>
          <li>
web.conig (XDT) transforms 
</li>
          <li>
How to publish to local file system using Visual Studio 
</li>
          <li>
How to publish to a 3rd party host using Visual Studio via MSDeploy 
</li>
          <li>
How to publish to local IIS server using the .cmd file generated by Visual Studio 
</li>
          <li>
How to use msdeploy.exe to delete IIS applications 
</li>
          <li>
How to use the IIS Manager to import web packages 
</li>
          <li>
How to use msdeploy.exe to deploy a web package to the local IIS server 
</li>
          <li>
How to use msdeploy.exe to deploy a web package to a remove IIS server 
</li>
          <li>
How to use msdeploy.exe to deploy a web package &amp; set parameters using SetParameters.xml
to a remote IIS server 
</li>
        </ul>
        <p>
You can download the video &amp; all of my sample files at <a href="http://virtualtechdays.com/pastevents_2010november.aspx">http://virtualtechdays.com/pastevents_2010november.aspx</a>.
In the samples you will find all of the scripts that I used and a bunch of others
which I didn’t have time to cover. Enjoy!
</p>
        <p>
Sayed Ibrahim Hashimi <a href="http://twitter.com/sayedihashimi">@sayedihashimi</a></p>
      </body>
      <title>Video on Web Deployment using Visual Studio 2010 and MSDeploy</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,d158f2b8-cdee-4257-86cd-401362deeff2.aspx</guid>
      <link>http://sedodream.com/2011/01/08/VideoOnWebDeploymentUsingVisualStudio2010AndMSDeploy.aspx</link>
      <pubDate>Sat, 08 Jan 2011 20:34:08 GMT</pubDate>
      <description>
&lt;p&gt;
Back in November I participated in &lt;a href="http://virtualtechdays.com/"&gt;Virtual Tech
Days&lt;/a&gt; which is an online conference presented by Microsoft. In the session I discussed
the enhancements to web deployment using Visual Studio 2010 and MSDeploy. Some of
the topics which I covered includ:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
web.conig (XDT) transforms 
&lt;/li&gt;
&lt;li&gt;
How to publish to local file system using Visual Studio 
&lt;/li&gt;
&lt;li&gt;
How to publish to a 3rd party host using Visual Studio via MSDeploy 
&lt;/li&gt;
&lt;li&gt;
How to publish to local IIS server using the .cmd file generated by Visual Studio 
&lt;/li&gt;
&lt;li&gt;
How to use msdeploy.exe to delete IIS applications 
&lt;/li&gt;
&lt;li&gt;
How to use the IIS Manager to import web packages 
&lt;/li&gt;
&lt;li&gt;
How to use msdeploy.exe to deploy a web package to the local IIS server 
&lt;/li&gt;
&lt;li&gt;
How to use msdeploy.exe to deploy a web package to a remove IIS server 
&lt;/li&gt;
&lt;li&gt;
How to use msdeploy.exe to deploy a web package &amp;amp; set parameters using SetParameters.xml
to a remote IIS server 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
You can download the video &amp;amp; all of my sample files at &lt;a href="http://virtualtechdays.com/pastevents_2010november.aspx"&gt;http://virtualtechdays.com/pastevents_2010november.aspx&lt;/a&gt;.
In the samples you will find all of the scripts that I used and a bunch of others
which I didn’t have time to cover. Enjoy!
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi &lt;a href="http://twitter.com/sayedihashimi"&gt;@sayedihashimi&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,d158f2b8-cdee-4257-86cd-401362deeff2.aspx</comments>
      <category>Config-Transformation</category>
      <category>IIS</category>
      <category>MSBuild</category>
      <category>MSDeploy</category>
      <category>speaking</category>
      <category>Visual Studio</category>
      <category>Visual Studio 2010</category>
      <category>web</category>
      <category>Web Deployment Tool</category>
      <category>Web Development</category>
      <category>Web Publishing Pipeline</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=dbdd0002-7b3c-47b1-b891-9c361b087af6</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,dbdd0002-7b3c-47b1-b891-9c361b087af6.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,dbdd0002-7b3c-47b1-b891-9c361b087af6.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=dbdd0002-7b3c-47b1-b891-9c361b087af6</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
One of the really cool features that we shipped for Visual Studio 2010 was <a href="http://msdn.microsoft.com/en-us/library/dd465326.aspx" target="_blank">web.config
(XDT) transformations</a>. Because the transformations are so simple and straightforward
one of the first questions that someone asks after using it is “how can I use this
in my other projects?” Unfortunately this feature is only built into the Web Application
Projects (WAP). But it is very easy to reuse this because we just rely on an MSBuild
task to do the heavy lifting for us. I received an email from that basically went
like this 
</p>
        <blockquote>
          <p>
            <em>“Hi, I would like to use XDT transformations on my WPF project for both the app.config
file as well as my unity.xml file. How can I do this?”</em>
          </p>
        </blockquote>
        <p>
So one answer is to modify your project file to use the TransformXml task as I have
blogged previously about (link below). But I thought that since this was such a common
problem that I should go ahead and create a .targets file which would solve the above
problem and could be re-used by anyone.
</p>
        <p>
Let me clarify the scenario a bit before we dive into the details of the solution.
I have create a sample Wpf project, named Wpf01. Inside of that project I have created
these files:
</p>
        <ul>
          <li>
app.confog</li>
          <ul>
            <li>
app.debug.config</li>
            <li>
app.release.config</li>
          </ul>
          <li>
Sample01.xml</li>
          <ul>
            <li>
Sample01.debug.xml</li>
            <li>
Sample01.release.xml</li>
          </ul>
          <li>
Sub\Sub\Sub01.xml</li>
          <ul>
            <li>
Sub\Sub\Sub01.debug.xml</li>
            <li>
Sub\Sub\Sub01.release.xml</li>
          </ul>
        </ul>
        <p>
Take a look at the image below (note: I manually edited the project file to make the
file nest under each other, I will explain that shortly)
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/XDT.config-Transforms-in-non-web-project_11EA1/image_2.png">
            <img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; 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/XDT.config-Transforms-in-non-web-project_11EA1/image_thumb.png" width="237" height="397" />
          </a>
        </p>
        <p>
The files with .debug/.release are transform files. When I build I expect the following
to happen:
</p>
        <ol>
          <li>
Transform app.config with app.{Configuration}.config and write file to output folder
with the correct name i.e. Wpf01.exe.config instead of just app.config</li>
          <li>
Transform Sample01.xml with Sample01.{Configuration}.config and write it to output
folder with the name Sample01.config</li>
          <li>
Transform Sub\Sub\Sub01.xml with Sub\Sub\Sub01.{Configuration}.config and write it
to the output folder with the name Sub\Sub\Sub01.xml</li>
          <li>
None of my source files should change</li>
        </ol>
        <h3>Usage
</h3>
        <p>
Before I get into the solution let me explain how to use the solution first because
if you are not interested in the MSBuild details you can skip over that <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://sedodream.com/content/binary/Windows-Live-Writer/XDT.config-Transforms-in-non-web-project_11EA1/wlEmoticon-smile_2.png" /></p>
        <ol>
          <li>
You must have installed Web projects with Visual Studio on the machine (it contains
the TransformXmll task).</li>
          <li>
Create the folder %ProgramFiles (x86)%\MSBuild\Custom. If you want to share this across
team members then see my note at the end of this blog.</li>
          <li>
Download TransformFiles.targets (link below) and place the file into the folder %ProgramFiles
(x86)%\MSBuild\Custom.</li>
          <li>
Edit your project file (right click on the project Unload Project, right click again
and pick edit)</li>
          <li>
At the end of the project file place the element <strong>&lt;Import Project="$(MSBuildExtensionsPath)\Custom\TransformFiles.targets"
/&gt;</strong> immediately above the closing &lt;/Project&gt; tag</li>
          <li>
For files that you want transformed a metadata value of TransformOnBuild to true.
See below on what this means.</li>
          <li>
Build and take a look at files in your output directory</li>
        </ol>
        <p>
For #5 lets examine the sample that I created. In this sample I had an app.config
file. When I first created the project the entry in the project file for app.config
looked like the following.
</p>
        <pre class="brush: xml;">&lt;None Include="app.config" /&gt;</pre>
        <p>
So what you need to do is to add a new metadata value as described above for that.
So it will turn into the following.
</p>
        <pre class="brush: xml;">&lt;None Include="app.config"&gt;
  &lt;TransformOnBuild&gt;true&lt;/TransformOnBuild&gt;
&lt;/None&gt;</pre>
        <p>
The transform targets will look for items that have this value declared on them and
then during build it will transform them, if the transform file exists in the same
folder as the file itself. You will need to add TransfromOnBuild to all the files
that you want to transform. So in my case I added it to app.config, Sample01.xml and
Sub01.xml. Note you should not add this to the transform files themselves because
you will just waste your own time. After you do this you should perform a build then
take a look at the output directory for your transformed files. The app.config should
write out the the correct file and the others as expected.
</p>
        <h3>Nest transforms under the source file
</h3>
        <p>
You might have noticed that in the image above that the transform files are nested
under the files themselves. To do this you need to add the DependentUpon metadata
value to the child items. For instance for app.config the child items look like the
following.
</p>
        <pre class="brush: xml;">&lt;None Include="app.debug.config"&gt;
  &lt;DependentUpon&gt;app.config&lt;/DependentUpon&gt;
&lt;/None&gt;
&lt;None Include="app.release.config"&gt;
  &lt;DependentUpon&gt;app.config&lt;/DependentUpon&gt;
&lt;/None&gt;</pre>
        <h3>Implementation
</h3>
        <p>
If you are wondering how this works then this is the section for you. TransformFile.targets
has 2 targets; DiscoverFilesToTransform and TransformAllFiles. DiscoverFilesToTransform
looks through a set of items (None, Content, and Resource). Inside of DiscoverFilesToTransform
I look for values with the %(TransformOnBuild)==true. After all of those are collected
I identify if there is an app.config file being transformed and if so it is placed
into a specific item list and all others go into another item list.
</p>
        <p>
Inside of TransformAllFiles the TransformXml task is used to transform all of the
files. This target injects itself into the build process by having the attribute <em>AfterTargets="Build;_CopyAppConfigFile"</em>.
So whenever the Build or _CopyAppConfigFile targets are called the TransformAllFiles
target will execute.
</p>
        <p>
Here if the full code for this file.
</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;UsingTask TaskName="TransformXml"
         AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll"/&gt;
  
  &lt;ItemDefinitionGroup&gt;
    &lt;!-- Set the default value to false here --&gt;
    &lt;None&gt;
      &lt;TransformOnBuild&gt;false&lt;/TransformOnBuild&gt;
    &lt;/None&gt;    
    &lt;Content&gt;
      &lt;TransformOnBuild&gt;false&lt;/TransformOnBuild&gt;
    &lt;/Content&gt;    
    &lt;Resource&gt;
      &lt;TransformOnBuild&gt;false&lt;/TransformOnBuild&gt;
    &lt;/Resource&gt;
    &lt;EmbeddedResource&gt;
      &lt;TransformOnBuild&gt;false&lt;/TransformOnBuild&gt;
    &lt;/EmbeddedResource&gt;
    
    &lt;_FilesToTransform&gt;
      &lt;IsAppConfig&gt;false&lt;/IsAppConfig&gt;
    &lt;/_FilesToTransform&gt;
  &lt;/ItemDefinitionGroup&gt;

  &lt;PropertyGroup&gt;
    &lt;TransformAllFilesDependsOn&gt;
      DiscoverFilesToTransform;
    &lt;/TransformAllFilesDependsOn&gt;
  &lt;/PropertyGroup&gt;
  &lt;Target Name="TransformAllFiles" DependsOnTargets="$(TransformAllFilesDependsOn)" AfterTargets="Build;_CopyAppConfigFile"&gt;
    &lt;!-- Now we have the item list _FilesToTransformNotAppConfig and _AppConfigToTransform item lists --&gt;
    &lt;!-- Transform the app.config file --&gt;    
    &lt;ItemGroup&gt;
      &lt;_AppConfigTarget Include="@(AppConfigWithTargetPath-&gt;'$(OutDir)%(TargetPath)')" /&gt;
    &lt;/ItemGroup&gt;
    
    &lt;PropertyGroup&gt;
      &lt;_AppConfigDest&gt;@(_AppConfigTarget-&gt;'%(FullPath)')&lt;/_AppConfigDest&gt;
    &lt;/PropertyGroup&gt;

    &lt;MakeDir Directories="@(_FilesToTransformNotAppConfig-&gt;'$(OutDir)%(RelativeDir)')"
             Condition="Exists('%(RelativeDir)%(Filename).$(Configuration)%(Extension)')"/&gt;
    
    &lt;TransformXml Source="@(_AppConfigToTransform-&gt;'%(FullPath)')"
                  Transform="%(RelativeDir)%(Filename).$(Configuration)%(Extension)"
                  Destination="$(_AppConfigDest)"
                  Condition=" Exists('%(RelativeDir)%(Filename).$(Configuration)%(Extension)') " /&gt;

    
    &lt;TransformXml Source="@(_FilesToTransformNotAppConfig-&gt;'%(FullPath)')"
                  Transform="%(RelativeDir)%(Filename).$(Configuration)%(Extension)"
                  Destination="@(_FilesToTransformNotAppConfig-&gt;'$(OutDir)%(RelativeDir)%(Filename)%(Extension)')"
                  Condition=" Exists('%(RelativeDir)%(Filename).$(Configuration)%(Extension)') " /&gt;
  &lt;/Target&gt;
  
  &lt;Target Name="DiscoverFilesToTransform"&gt;
    &lt;!-- 
    This will look through items list: None &amp; Content for those
    with Metadata &lt;TransformOnBuild&gt;True&lt;/TransformOnBuild&gt;
    --&gt;
    &lt;ItemGroup&gt;
      &lt;_FilesToTransform Include="@(None);@(Content);@(Resource);@(EmbeddedResource)"
                         Condition=" '%(TransformOnBuild)' == 'true' "/&gt;
    &lt;/ItemGroup&gt;    

    &lt;PropertyGroup&gt;
      &lt;_AppConfigFullPath&gt;@(AppConfigWithTargetPath-&gt;'%(RootDir)%(Directory)%(Filename)%(Extension)')&lt;/_AppConfigFullPath&gt;
    &lt;/PropertyGroup&gt;

    &lt;!-- Now look to see if any of these are the app.config file --&gt;
    &lt;ItemGroup&gt;
      &lt;_FilesToTransform Condition=" '%(FullPath)'=='$(_AppConfigFullPath)' "&gt;
        &lt;IsAppConfig&gt;true&lt;/IsAppConfig&gt;
      &lt;/_FilesToTransform&gt;
    &lt;/ItemGroup&gt;
          
    &lt;ItemGroup&gt;
      &lt;_FilesToTransformNotAppConfig Include="@(_FilesToTransform)"
                                     Condition=" '%(IsAppConfig)'!='true'"/&gt;
      
      &lt;_AppConfigToTransform  Include="@(_FilesToTransform)"
                              Condition=" '%(IsAppConfig)'=='true'"/&gt;
    &lt;/ItemGroup&gt;
  &lt;/Target&gt;
&lt;/Project&gt;</pre>
        <h3>Gaps
</h3>
        <p>
With most things found on blogs there are some gaps Those are described here.
</p>
        <p>
          <u>Clean build</u> =&gt; It’s a best practice to delete files upon clean, but in this
case I am not. This would be pretty easy to add, if you are interested let us know
and I will update the sample.
</p>
        <p>
          <u>Incremental build</u> =&gt; The transforms will run every time you build even if
the outputs are up to date, if this is an issue for you let us know and I will update
the sample.
</p>
        <h3>Sharing with team members
</h3>
        <p>
If you want to share with team members instead of placing this into %ProgramFiles
(x86)% just place it into a folder in version control then change the <em>&lt;Import</em> statement
to point to that file instead of using MSBuildExtensionPath.
</p>
        <h3> 
</h3>
        <p>
          <font style="background-color: #ffff00">If you end up using this please let us know
what is your experience with it.</font>
        </p>
        <h3>Resources
</h3>
        <ul>
          <li>
            <a href="http://sedotech.com/Content/samples/TransformFiles.targets" target="_blank">TransformFiles.targets</a>
          </li>
          <li>
            <a href="http://sedotech.com/Content/samples/TransformExample.zip" target="_blank">Transform
Sample</a>
          </li>
          <li>
            <a href="http://sedodream.com/2010/04/26/ConfigTransformationsOutsideOfWebAppBuilds.aspx">Config
transformations outside of web app builds</a>
          </li>
          <li>
            <a href="http://sedodream.com/2010/09/09/ExtendingXMLWebconfigConfigTransformation.aspx">Extending
XML (web.config) Config transformation</a>
          </li>
          <li>
            <a href="http://sedodream.com/2010/11/11/ASPNETWebApplicationPublishPackageTokenizingParameters.aspx">ASP.NET
Web Application: Publish/Package Tokenizing Parameters</a>
          </li>
        </ul>
        <p>
Sayed Ibrahim Hashimi <a href="http://twitter.com/sayedihashimi" target="_blank">@sayedihashimi</a></p>
      </body>
      <title>XDT (web.config) Transforms in non-web projects</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,dbdd0002-7b3c-47b1-b891-9c361b087af6.aspx</guid>
      <link>http://sedodream.com/2010/11/18/XDTWebconfigTransformsInNonwebProjects.aspx</link>
      <pubDate>Thu, 18 Nov 2010 05:41:09 GMT</pubDate>
      <description>&lt;p&gt;
One of the really cool features that we shipped for Visual Studio 2010 was &lt;a href="http://msdn.microsoft.com/en-us/library/dd465326.aspx" target="_blank"&gt;web.config
(XDT) transformations&lt;/a&gt;. Because the transformations are so simple and straightforward
one of the first questions that someone asks after using it is “how can I use this
in my other projects?” Unfortunately this feature is only built into the Web Application
Projects (WAP). But it is very easy to reuse this because we just rely on an MSBuild
task to do the heavy lifting for us. I received an email from that basically went
like this 
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;em&gt;“Hi, I would like to use XDT transformations on my WPF project for both the app.config
file as well as my unity.xml file. How can I do this?”&lt;/em&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
So one answer is to modify your project file to use the TransformXml task as I have
blogged previously about (link below). But I thought that since this was such a common
problem that I should go ahead and create a .targets file which would solve the above
problem and could be re-used by anyone.
&lt;/p&gt;
&lt;p&gt;
Let me clarify the scenario a bit before we dive into the details of the solution.
I have create a sample Wpf project, named Wpf01. Inside of that project I have created
these files:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
app.confog&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
app.debug.config&lt;/li&gt;
&lt;li&gt;
app.release.config&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Sample01.xml&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
Sample01.debug.xml&lt;/li&gt;
&lt;li&gt;
Sample01.release.xml&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Sub\Sub\Sub01.xml&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
Sub\Sub\Sub01.debug.xml&lt;/li&gt;
&lt;li&gt;
Sub\Sub\Sub01.release.xml&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt;
Take a look at the image below (note: I manually edited the project file to make the
file nest under each other, I will explain that shortly)
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/XDT.config-Transforms-in-non-web-project_11EA1/image_2.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; 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/XDT.config-Transforms-in-non-web-project_11EA1/image_thumb.png" width="237" height="397" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
The files with .debug/.release are transform files. When I build I expect the following
to happen:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Transform app.config with app.{Configuration}.config and write file to output folder
with the correct name i.e. Wpf01.exe.config instead of just app.config&lt;/li&gt;
&lt;li&gt;
Transform Sample01.xml with Sample01.{Configuration}.config and write it to output
folder with the name Sample01.config&lt;/li&gt;
&lt;li&gt;
Transform Sub\Sub\Sub01.xml with Sub\Sub\Sub01.{Configuration}.config and write it
to the output folder with the name Sub\Sub\Sub01.xml&lt;/li&gt;
&lt;li&gt;
None of my source files should change&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;Usage
&lt;/h3&gt;
&lt;p&gt;
Before I get into the solution let me explain how to use the solution first because
if you are not interested in the MSBuild details you can skip over that &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://sedodream.com/content/binary/Windows-Live-Writer/XDT.config-Transforms-in-non-web-project_11EA1/wlEmoticon-smile_2.png" /&gt;
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
You must have installed Web projects with Visual Studio on the machine (it contains
the TransformXmll task).&lt;/li&gt;
&lt;li&gt;
Create the folder %ProgramFiles (x86)%\MSBuild\Custom. If you want to share this across
team members then see my note at the end of this blog.&lt;/li&gt;
&lt;li&gt;
Download TransformFiles.targets (link below) and place the file into the folder %ProgramFiles
(x86)%\MSBuild\Custom.&lt;/li&gt;
&lt;li&gt;
Edit your project file (right click on the project Unload Project, right click again
and pick edit)&lt;/li&gt;
&lt;li&gt;
At the end of the project file place the element &lt;strong&gt;&amp;lt;Import Project=&amp;quot;$(MSBuildExtensionsPath)\Custom\TransformFiles.targets&amp;quot;
/&amp;gt;&lt;/strong&gt; immediately above the closing &amp;lt;/Project&amp;gt; tag&lt;/li&gt;
&lt;li&gt;
For files that you want transformed a metadata value of TransformOnBuild to true.
See below on what this means.&lt;/li&gt;
&lt;li&gt;
Build and take a look at files in your output directory&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
For #5 lets examine the sample that I created. In this sample I had an app.config
file. When I first created the project the entry in the project file for app.config
looked like the following.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;None Include=&amp;quot;app.config&amp;quot; /&amp;gt;&lt;/pre&gt;
&lt;p&gt;
So what you need to do is to add a new metadata value as described above for that.
So it will turn into the following.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;None Include=&amp;quot;app.config&amp;quot;&amp;gt;
  &amp;lt;TransformOnBuild&amp;gt;true&amp;lt;/TransformOnBuild&amp;gt;
&amp;lt;/None&amp;gt;&lt;/pre&gt;
&lt;p&gt;
The transform targets will look for items that have this value declared on them and
then during build it will transform them, if the transform file exists in the same
folder as the file itself. You will need to add TransfromOnBuild to all the files
that you want to transform. So in my case I added it to app.config, Sample01.xml and
Sub01.xml. Note you should not add this to the transform files themselves because
you will just waste your own time. After you do this you should perform a build then
take a look at the output directory for your transformed files. The app.config should
write out the the correct file and the others as expected.
&lt;/p&gt;
&lt;h3&gt;Nest transforms under the source file
&lt;/h3&gt;
&lt;p&gt;
You might have noticed that in the image above that the transform files are nested
under the files themselves. To do this you need to add the DependentUpon metadata
value to the child items. For instance for app.config the child items look like the
following.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;None Include=&amp;quot;app.debug.config&amp;quot;&amp;gt;
  &amp;lt;DependentUpon&amp;gt;app.config&amp;lt;/DependentUpon&amp;gt;
&amp;lt;/None&amp;gt;
&amp;lt;None Include=&amp;quot;app.release.config&amp;quot;&amp;gt;
  &amp;lt;DependentUpon&amp;gt;app.config&amp;lt;/DependentUpon&amp;gt;
&amp;lt;/None&amp;gt;&lt;/pre&gt;
&lt;h3&gt;Implementation
&lt;/h3&gt;
&lt;p&gt;
If you are wondering how this works then this is the section for you. TransformFile.targets
has 2 targets; DiscoverFilesToTransform and TransformAllFiles. DiscoverFilesToTransform
looks through a set of items (None, Content, and Resource). Inside of DiscoverFilesToTransform
I look for values with the %(TransformOnBuild)==true. After all of those are collected
I identify if there is an app.config file being transformed and if so it is placed
into a specific item list and all others go into another item list.
&lt;/p&gt;
&lt;p&gt;
Inside of TransformAllFiles the TransformXml task is used to transform all of the
files. This target injects itself into the build process by having the attribute &lt;em&gt;AfterTargets=&amp;quot;Build;_CopyAppConfigFile&amp;quot;&lt;/em&gt;.
So whenever the Build or _CopyAppConfigFile targets are called the TransformAllFiles
target will execute.
&lt;/p&gt;
&lt;p&gt;
Here if the full code for this file.
&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;UsingTask TaskName=&amp;quot;TransformXml&amp;quot;
         AssemblyFile=&amp;quot;$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll&amp;quot;/&amp;gt;
  
  &amp;lt;ItemDefinitionGroup&amp;gt;
    &amp;lt;!-- Set the default value to false here --&amp;gt;
    &amp;lt;None&amp;gt;
      &amp;lt;TransformOnBuild&amp;gt;false&amp;lt;/TransformOnBuild&amp;gt;
    &amp;lt;/None&amp;gt;    
    &amp;lt;Content&amp;gt;
      &amp;lt;TransformOnBuild&amp;gt;false&amp;lt;/TransformOnBuild&amp;gt;
    &amp;lt;/Content&amp;gt;    
    &amp;lt;Resource&amp;gt;
      &amp;lt;TransformOnBuild&amp;gt;false&amp;lt;/TransformOnBuild&amp;gt;
    &amp;lt;/Resource&amp;gt;
    &amp;lt;EmbeddedResource&amp;gt;
      &amp;lt;TransformOnBuild&amp;gt;false&amp;lt;/TransformOnBuild&amp;gt;
    &amp;lt;/EmbeddedResource&amp;gt;
    
    &amp;lt;_FilesToTransform&amp;gt;
      &amp;lt;IsAppConfig&amp;gt;false&amp;lt;/IsAppConfig&amp;gt;
    &amp;lt;/_FilesToTransform&amp;gt;
  &amp;lt;/ItemDefinitionGroup&amp;gt;

  &amp;lt;PropertyGroup&amp;gt;
    &amp;lt;TransformAllFilesDependsOn&amp;gt;
      DiscoverFilesToTransform;
    &amp;lt;/TransformAllFilesDependsOn&amp;gt;
  &amp;lt;/PropertyGroup&amp;gt;
  &amp;lt;Target Name=&amp;quot;TransformAllFiles&amp;quot; DependsOnTargets=&amp;quot;$(TransformAllFilesDependsOn)&amp;quot; AfterTargets=&amp;quot;Build;_CopyAppConfigFile&amp;quot;&amp;gt;
    &amp;lt;!-- Now we have the item list _FilesToTransformNotAppConfig and _AppConfigToTransform item lists --&amp;gt;
    &amp;lt;!-- Transform the app.config file --&amp;gt;    
    &amp;lt;ItemGroup&amp;gt;
      &amp;lt;_AppConfigTarget Include=&amp;quot;@(AppConfigWithTargetPath-&amp;gt;'$(OutDir)%(TargetPath)')&amp;quot; /&amp;gt;
    &amp;lt;/ItemGroup&amp;gt;
    
    &amp;lt;PropertyGroup&amp;gt;
      &amp;lt;_AppConfigDest&amp;gt;@(_AppConfigTarget-&amp;gt;'%(FullPath)')&amp;lt;/_AppConfigDest&amp;gt;
    &amp;lt;/PropertyGroup&amp;gt;

    &amp;lt;MakeDir Directories=&amp;quot;@(_FilesToTransformNotAppConfig-&amp;gt;'$(OutDir)%(RelativeDir)')&amp;quot;
             Condition=&amp;quot;Exists('%(RelativeDir)%(Filename).$(Configuration)%(Extension)')&amp;quot;/&amp;gt;
    
    &amp;lt;TransformXml Source=&amp;quot;@(_AppConfigToTransform-&amp;gt;'%(FullPath)')&amp;quot;
                  Transform=&amp;quot;%(RelativeDir)%(Filename).$(Configuration)%(Extension)&amp;quot;
                  Destination=&amp;quot;$(_AppConfigDest)&amp;quot;
                  Condition=&amp;quot; Exists('%(RelativeDir)%(Filename).$(Configuration)%(Extension)') &amp;quot; /&amp;gt;

    
    &amp;lt;TransformXml Source=&amp;quot;@(_FilesToTransformNotAppConfig-&amp;gt;'%(FullPath)')&amp;quot;
                  Transform=&amp;quot;%(RelativeDir)%(Filename).$(Configuration)%(Extension)&amp;quot;
                  Destination=&amp;quot;@(_FilesToTransformNotAppConfig-&amp;gt;'$(OutDir)%(RelativeDir)%(Filename)%(Extension)')&amp;quot;
                  Condition=&amp;quot; Exists('%(RelativeDir)%(Filename).$(Configuration)%(Extension)') &amp;quot; /&amp;gt;
  &amp;lt;/Target&amp;gt;
  
  &amp;lt;Target Name=&amp;quot;DiscoverFilesToTransform&amp;quot;&amp;gt;
    &amp;lt;!-- 
    This will look through items list: None &amp;amp; Content for those
    with Metadata &amp;lt;TransformOnBuild&amp;gt;True&amp;lt;/TransformOnBuild&amp;gt;
    --&amp;gt;
    &amp;lt;ItemGroup&amp;gt;
      &amp;lt;_FilesToTransform Include=&amp;quot;@(None);@(Content);@(Resource);@(EmbeddedResource)&amp;quot;
                         Condition=&amp;quot; '%(TransformOnBuild)' == 'true' &amp;quot;/&amp;gt;
    &amp;lt;/ItemGroup&amp;gt;    

    &amp;lt;PropertyGroup&amp;gt;
      &amp;lt;_AppConfigFullPath&amp;gt;@(AppConfigWithTargetPath-&amp;gt;'%(RootDir)%(Directory)%(Filename)%(Extension)')&amp;lt;/_AppConfigFullPath&amp;gt;
    &amp;lt;/PropertyGroup&amp;gt;

    &amp;lt;!-- Now look to see if any of these are the app.config file --&amp;gt;
    &amp;lt;ItemGroup&amp;gt;
      &amp;lt;_FilesToTransform Condition=&amp;quot; '%(FullPath)'=='$(_AppConfigFullPath)' &amp;quot;&amp;gt;
        &amp;lt;IsAppConfig&amp;gt;true&amp;lt;/IsAppConfig&amp;gt;
      &amp;lt;/_FilesToTransform&amp;gt;
    &amp;lt;/ItemGroup&amp;gt;
          
    &amp;lt;ItemGroup&amp;gt;
      &amp;lt;_FilesToTransformNotAppConfig Include=&amp;quot;@(_FilesToTransform)&amp;quot;
                                     Condition=&amp;quot; '%(IsAppConfig)'!='true'&amp;quot;/&amp;gt;
      
      &amp;lt;_AppConfigToTransform  Include=&amp;quot;@(_FilesToTransform)&amp;quot;
                              Condition=&amp;quot; '%(IsAppConfig)'=='true'&amp;quot;/&amp;gt;
    &amp;lt;/ItemGroup&amp;gt;
  &amp;lt;/Target&amp;gt;
&amp;lt;/Project&amp;gt;&lt;/pre&gt;
&lt;h3&gt;Gaps
&lt;/h3&gt;
&lt;p&gt;
With most things found on blogs there are some gaps Those are described here.
&lt;/p&gt;
&lt;p&gt;
&lt;u&gt;Clean build&lt;/u&gt; =&amp;gt; It’s a best practice to delete files upon clean, but in this
case I am not. This would be pretty easy to add, if you are interested let us know
and I will update the sample.
&lt;/p&gt;
&lt;p&gt;
&lt;u&gt;Incremental build&lt;/u&gt; =&amp;gt; The transforms will run every time you build even if
the outputs are up to date, if this is an issue for you let us know and I will update
the sample.
&lt;/p&gt;
&lt;h3&gt;Sharing with team members
&lt;/h3&gt;
&lt;p&gt;
If you want to share with team members instead of placing this into %ProgramFiles
(x86)% just place it into a folder in version control then change the &lt;em&gt;&amp;lt;Import&lt;/em&gt; statement
to point to that file instead of using MSBuildExtensionPath.
&lt;/p&gt;
&lt;h3&gt;&amp;#160;
&lt;/h3&gt;
&lt;p&gt;
&lt;font style="background-color: #ffff00"&gt;If you end up using this please let us know
what is your experience with it.&lt;/font&gt;
&lt;/p&gt;
&lt;h3&gt;Resources
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://sedotech.com/Content/samples/TransformFiles.targets" target="_blank"&gt;TransformFiles.targets&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://sedotech.com/Content/samples/TransformExample.zip" target="_blank"&gt;Transform
Sample&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://sedodream.com/2010/04/26/ConfigTransformationsOutsideOfWebAppBuilds.aspx"&gt;Config
transformations outside of web app builds&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://sedodream.com/2010/09/09/ExtendingXMLWebconfigConfigTransformation.aspx"&gt;Extending
XML (web.config) Config transformation&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://sedodream.com/2010/11/11/ASPNETWebApplicationPublishPackageTokenizingParameters.aspx"&gt;ASP.NET
Web Application: Publish/Package Tokenizing Parameters&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi &lt;a href="http://twitter.com/sayedihashimi" target="_blank"&gt;@sayedihashimi&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,dbdd0002-7b3c-47b1-b891-9c361b087af6.aspx</comments>
      <category>MSBuild</category>
      <category>MSBuild 4.0</category>
      <category>MSDeploy</category>
      <category>Web Publishing Pipeline</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=c74e3388-0bdd-4295-85cb-b9ef0286947a</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,c74e3388-0bdd-4295-85cb-b9ef0286947a.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,c74e3388-0bdd-4295-85cb-b9ef0286947a.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=c74e3388-0bdd-4295-85cb-b9ef0286947a</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Today I just saw a question posted on stackoverflow.com asking <a href="http://stackoverflow.com/q/4151325/105999" target="_blank">Why
are some Web.config transforms tokenised into SetParameters.xml and others are not</a>?
Let me give some background on this topic for those who are not aware of what the
question is.
</p>
        <p>
With Visual Studio 2010 when you package your application using the Build Deployment
Package context menu option, see image below.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/e49083eab7c6_12533/image_2.png">
            <img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/e49083eab7c6_12533/image_thumb.png" width="352" height="484" />
          </a>
        </p>
        <p>
When build the package by default the package will be created in obj\{Configuration}\Package\{ProjectName}.zip
where {Configuration} is the current build configuration, and {ProjectName} is the
name of the project. So in this case I since I’m building with Debug and the project
name is MvcApplication1 the package will be placed at <strong>obj\Debug\Package\MvcApplication1.zip</strong>.
If you take this package and then import into IIS 7 with the “Import Application”
option shown below. Note: The machine must have the <a href="http://www.iis.net/download/WebDeploy" target="_blank">Web
Deployment Tool</a> (aka MSDeploy) installed.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/e49083eab7c6_12533/image_4.png">
            <img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/e49083eab7c6_12533/image_thumb_1.png" width="218" height="280" />
          </a>
        </p>
        <p>
Once you click on Import Application then browse out to the package you will be shown
a screen which prompts your for parameters. Its shown below.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/e49083eab7c6_12533/SNAGHTML2d2664.png">
            <img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTML2d2664" border="0" alt="SNAGHTML2d2664" src="http://sedodream.com/content/binary/Windows-Live-Writer/e49083eab7c6_12533/SNAGHTML2d2664_thumb.png" width="681" height="514" />
          </a>
        </p>
        <p>
On this screen you can see that we are prompting for a couple parameter values here.
One is an IIS setting, Application Path, and the other is a connection string which
will be placed inside the web.config file. If your Web Application Project (WAP) 
had 5 different connection strings then they would automatically show up here on this
page. Since connection strings are replaced so often we create parameters for all
connection strings by default. You can define new parameters on your own, quite easily
actually, but that is the topic for another blog post.
</p>
        <p>
Now back to the question. He is asking why do we “tokenize” the connection strings
in web.config. To clarify take a look at my web.config file below.
</p>
        <pre class="brush: xml;">&lt;configuration&gt;
  &lt;appSettings&gt;
    &lt;add key="setting01" value="value01"/&gt;
  &lt;/appSettings&gt;
  
  &lt;connectionStrings&gt;
    &lt;add name="ApplicationServices"
         connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
         providerName="System.Data.SqlClient" /&gt;
  &lt;/connectionStrings&gt;
  
&lt;/configuration&gt;</pre>
        <p>
After I perform a package this will get changed. Take a look @ the web.config file
which resides in the package (you can get to the file at obj\{CofigurationName}\Package\PackageTmp\web.config).
You will see what is shown below.
</p>
        <pre class="brush: xml;">&lt;configuration&gt;
  &lt;appSettings&gt;
    &lt;add key="setting01" value="value01"/&gt;
  &lt;/appSettings&gt;
  &lt;connectionStrings&gt;
    &lt;add name="ApplicationServices"
         connectionString="$(ReplacableToken_ApplicationServices-Web.config Connection String_0)"
         providerName="System.Data.SqlClient" /&gt;
  &lt;/connectionStrings&gt;

&lt;/configuration&gt;</pre>
        <p>
So his question is why is the connection string replaced with $(ReplacableToken_ApplicationServices-Web.config
Connection String_0) and nothing else is? We do this because we do not want you to
accidently copy your web to a location and have it executing SQL statements against
a SQL server which you did not intend. The idea is that you will create a package
that you can deploy to many different environments. So the value that was in your
web.config (or web.debug.config/web.release.config if you are using a <a href="http://blogs.msdn.com/b/webdevtools/archive/2009/05/04/web-deployment-web-config-transformation.aspx?wa=wsignin1.0" target="_blank">web.config
transformation</a>) will not be placed inside the web.config in the package. Instead
those values will be used as defaults in the package itself. We also create a SetParameters.xml
file for you so that you can tweak the values. For my app see the MvcApplication1.SetParameters.xml
file below.
</p>
        <pre class="brush: xml;">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;parameters&gt;
  &lt;setParameter name="IIS Web Application Name" 
                value="Default Web Site/MvcApplication1_deploy" /&gt;
  &lt;setParameter name="ApplicationServices-Web.config Connection String" 
                value="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" /&gt;
&lt;/parameters&gt;</pre>
        <p>
The idea is that you can deploy your package in 2 ways. Through the IIS Manager which
will prompt you for the parameters or you can deploy using msdeploy.exe with the –setParamFile
switch to specify the path to the SetParameters.xml file. In this case I could create
a QA01.SetParameters.xml file along with a QA02.SetParameters.xml file to deploy my
web to my two QA servers. How do we do this?
</p>
        <h4>How connection strings are tokenized
</h4>
        <p>
You might be wondering how the connection strings are tokenized to begin with. With
Visual Studio 2010 we released web.config transformations, which all you to write
terse web.config transformations inside of files like web.debug.config/web.release.config.
When you package/publish your web these transform files are used to transform your
web.config based on what you expressed in the appropriate transform file. We have
an MSBuild task TransformXml which performs the transformation. We use that same task
to tokenize the connection strings. If you are interested in the details take a look
at %ProgramFiles32%\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets
in the <strong>AutoParameterizationWebConfigConnectionStringsCore</strong> target.
</p>
        <p>
Now what if you do not want the connection string tokenized?
</p>
        <h4>Prevent tokenizing connection strings
</h4>
        <p>
If you want to prevent your web.config connection strings from being tokenized it’s
pretty easy. All we need to do is the add a property to the build/package/publish
process. We can do that in 2 ways. Edit the project file itself or create a file with
the name {ProjectName}.wpp.targets where {ProjectName} is the name of your project.
The second approach is easier so I use that. In my case it would be MvcApplication1.wpp.targets.
The contents of the file are shown below.
</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;PropertyGroup&gt;
    &lt;AutoParameterizationWebConfigConnectionStrings&gt;false&lt;/AutoParameterizationWebConfigConnectionStrings&gt;
  &lt;/PropertyGroup&gt;
  
&lt;/Project&gt;

<strong><u>Note:
You may need to reload the project in Visual Studio for this to take effect.</u></strong></pre>
        <p>
Inside of this file I have declared the property, AutoParameterizationWebConfigConnectionStrings,
to be false. This is telling the Web Publishing Pipeline (WPP) that it should not
replace replace the connection strings with tokens, instead leave them as they are.
</p>
        <p>
Questions/Comments???
</p>
        <h4>Other Resources
</h4>
        <ul>
          <li>
            <a href="http://sedodream.com/2010/04/26/ConfigTransformationsOutsideOfWebAppBuilds.aspx">Config
transformations outside of web app builds</a>
          </li>
          <li>
            <a href="http://sedodream.com/2010/09/09/ExtendingXMLWebconfigConfigTransformation.aspx">Extending
XML (web.config) Config transformation</a>
          </li>
        </ul>
      </body>
      <title>ASP.NET Web Application: Publish/Package Tokenizing Parameters</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,c74e3388-0bdd-4295-85cb-b9ef0286947a.aspx</guid>
      <link>http://sedodream.com/2010/11/11/ASPNETWebApplicationPublishPackageTokenizingParameters.aspx</link>
      <pubDate>Thu, 11 Nov 2010 05:41:09 GMT</pubDate>
      <description>&lt;p&gt;
Today I just saw a question posted on stackoverflow.com asking &lt;a href="http://stackoverflow.com/q/4151325/105999" target="_blank"&gt;Why
are some Web.config transforms tokenised into SetParameters.xml and others are not&lt;/a&gt;?
Let me give some background on this topic for those who are not aware of what the
question is.
&lt;/p&gt;
&lt;p&gt;
With Visual Studio 2010 when you package your application using the Build Deployment
Package context menu option, see image below.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/e49083eab7c6_12533/image_2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/e49083eab7c6_12533/image_thumb.png" width="352" height="484" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
When build the package by default the package will be created in obj\{Configuration}\Package\{ProjectName}.zip
where {Configuration} is the current build configuration, and {ProjectName} is the
name of the project. So in this case I since I’m building with Debug and the project
name is MvcApplication1 the package will be placed at &lt;strong&gt;obj\Debug\Package\MvcApplication1.zip&lt;/strong&gt;.
If you take this package and then import into IIS 7 with the “Import Application”
option shown below. Note: The machine must have the &lt;a href="http://www.iis.net/download/WebDeploy" target="_blank"&gt;Web
Deployment Tool&lt;/a&gt; (aka MSDeploy) installed.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/e49083eab7c6_12533/image_4.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/e49083eab7c6_12533/image_thumb_1.png" width="218" height="280" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Once you click on Import Application then browse out to the package you will be shown
a screen which prompts your for parameters. Its shown below.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/e49083eab7c6_12533/SNAGHTML2d2664.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTML2d2664" border="0" alt="SNAGHTML2d2664" src="http://sedodream.com/content/binary/Windows-Live-Writer/e49083eab7c6_12533/SNAGHTML2d2664_thumb.png" width="681" height="514" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
On this screen you can see that we are prompting for a couple parameter values here.
One is an IIS setting, Application Path, and the other is a connection string which
will be placed inside the web.config file. If your Web Application Project (WAP)&amp;#160;
had 5 different connection strings then they would automatically show up here on this
page. Since connection strings are replaced so often we create parameters for all
connection strings by default. You can define new parameters on your own, quite easily
actually, but that is the topic for another blog post.
&lt;/p&gt;
&lt;p&gt;
Now back to the question. He is asking why do we “tokenize” the connection strings
in web.config. To clarify take a look at my web.config file below.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;configuration&amp;gt;
  &amp;lt;appSettings&amp;gt;
    &amp;lt;add key=&amp;quot;setting01&amp;quot; value=&amp;quot;value01&amp;quot;/&amp;gt;
  &amp;lt;/appSettings&amp;gt;
  
  &amp;lt;connectionStrings&amp;gt;
    &amp;lt;add name=&amp;quot;ApplicationServices&amp;quot;
         connectionString=&amp;quot;data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true&amp;quot;
         providerName=&amp;quot;System.Data.SqlClient&amp;quot; /&amp;gt;
  &amp;lt;/connectionStrings&amp;gt;
  
&amp;lt;/configuration&amp;gt;&lt;/pre&gt;
&lt;p&gt;
After I perform a package this will get changed. Take a look @ the web.config file
which resides in the package (you can get to the file at obj\{CofigurationName}\Package\PackageTmp\web.config).
You will see what is shown below.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;configuration&amp;gt;
  &amp;lt;appSettings&amp;gt;
    &amp;lt;add key=&amp;quot;setting01&amp;quot; value=&amp;quot;value01&amp;quot;/&amp;gt;
  &amp;lt;/appSettings&amp;gt;
  &amp;lt;connectionStrings&amp;gt;
    &amp;lt;add name=&amp;quot;ApplicationServices&amp;quot;
         connectionString=&amp;quot;$(ReplacableToken_ApplicationServices-Web.config Connection String_0)&amp;quot;
         providerName=&amp;quot;System.Data.SqlClient&amp;quot; /&amp;gt;
  &amp;lt;/connectionStrings&amp;gt;

&amp;lt;/configuration&amp;gt;&lt;/pre&gt;
&lt;p&gt;
So his question is why is the connection string replaced with $(ReplacableToken_ApplicationServices-Web.config
Connection String_0) and nothing else is? We do this because we do not want you to
accidently copy your web to a location and have it executing SQL statements against
a SQL server which you did not intend. The idea is that you will create a package
that you can deploy to many different environments. So the value that was in your
web.config (or web.debug.config/web.release.config if you are using a &lt;a href="http://blogs.msdn.com/b/webdevtools/archive/2009/05/04/web-deployment-web-config-transformation.aspx?wa=wsignin1.0" target="_blank"&gt;web.config
transformation&lt;/a&gt;) will not be placed inside the web.config in the package. Instead
those values will be used as defaults in the package itself. We also create a SetParameters.xml
file for you so that you can tweak the values. For my app see the MvcApplication1.SetParameters.xml
file below.
&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;parameters&amp;gt;
  &amp;lt;setParameter name=&amp;quot;IIS Web Application Name&amp;quot; 
                value=&amp;quot;Default Web Site/MvcApplication1_deploy&amp;quot; /&amp;gt;
  &amp;lt;setParameter name=&amp;quot;ApplicationServices-Web.config Connection String&amp;quot; 
                value=&amp;quot;data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true&amp;quot; /&amp;gt;
&amp;lt;/parameters&amp;gt;&lt;/pre&gt;
&lt;p&gt;
The idea is that you can deploy your package in 2 ways. Through the IIS Manager which
will prompt you for the parameters or you can deploy using msdeploy.exe with the –setParamFile
switch to specify the path to the SetParameters.xml file. In this case I could create
a QA01.SetParameters.xml file along with a QA02.SetParameters.xml file to deploy my
web to my two QA servers. How do we do this?
&lt;/p&gt;
&lt;h4&gt;How connection strings are tokenized
&lt;/h4&gt;
&lt;p&gt;
You might be wondering how the connection strings are tokenized to begin with. With
Visual Studio 2010 we released web.config transformations, which all you to write
terse web.config transformations inside of files like web.debug.config/web.release.config.
When you package/publish your web these transform files are used to transform your
web.config based on what you expressed in the appropriate transform file. We have
an MSBuild task TransformXml which performs the transformation. We use that same task
to tokenize the connection strings. If you are interested in the details take a look
at %ProgramFiles32%\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets
in the &lt;strong&gt;AutoParameterizationWebConfigConnectionStringsCore&lt;/strong&gt; target.
&lt;/p&gt;
&lt;p&gt;
Now what if you do not want the connection string tokenized?
&lt;/p&gt;
&lt;h4&gt;Prevent tokenizing connection strings
&lt;/h4&gt;
&lt;p&gt;
If you want to prevent your web.config connection strings from being tokenized it’s
pretty easy. All we need to do is the add a property to the build/package/publish
process. We can do that in 2 ways. Edit the project file itself or create a file with
the name {ProjectName}.wpp.targets where {ProjectName} is the name of your project.
The second approach is easier so I use that. In my case it would be MvcApplication1.wpp.targets.
The contents of the file are shown below.
&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;PropertyGroup&amp;gt;
    &amp;lt;AutoParameterizationWebConfigConnectionStrings&amp;gt;false&amp;lt;/AutoParameterizationWebConfigConnectionStrings&amp;gt;
  &amp;lt;/PropertyGroup&amp;gt;
  
&amp;lt;/Project&amp;gt;

&lt;strong&gt;&lt;u&gt;Note:
You may need to reload the project in Visual Studio for this to take effect.&lt;/u&gt;&lt;/strong&gt;&lt;/pre&gt;
&lt;p&gt;
Inside of this file I have declared the property, AutoParameterizationWebConfigConnectionStrings,
to be false. This is telling the Web Publishing Pipeline (WPP) that it should not
replace replace the connection strings with tokens, instead leave them as they are.
&lt;/p&gt;
&lt;p&gt;
Questions/Comments???
&lt;/p&gt;
&lt;h4&gt;Other Resources
&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://sedodream.com/2010/04/26/ConfigTransformationsOutsideOfWebAppBuilds.aspx"&gt;Config
transformations outside of web app builds&lt;/a&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://sedodream.com/2010/09/09/ExtendingXMLWebconfigConfigTransformation.aspx"&gt;Extending
XML (web.config) Config transformation&lt;/a&gt; 
&lt;/li&gt;
&lt;/ul&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,c74e3388-0bdd-4295-85cb-b9ef0286947a.aspx</comments>
      <category>asp.net</category>
      <category>Deployment</category>
      <category>MSBuild</category>
      <category>MSBuild 4.0</category>
      <category>MSDeploy</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=269ec8d3-9d71-400a-bd99-cc3ea5d0c834</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,269ec8d3-9d71-400a-bd99-cc3ea5d0c834.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,269ec8d3-9d71-400a-bd99-cc3ea5d0c834.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=269ec8d3-9d71-400a-bd99-cc3ea5d0c834</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I just saw a post on <a href="http://twitter.com/#!/troyahunt/status/29612666076">twitter</a> asking
the question
</p>
        <blockquote>
          <p>
            <strong>
              <em>Is there any easy way to see the underlying MSBuild command when building
in VS2010? Want to see the MSDeploy params. @</em>
            </strong>
            <a href="http://twitter.com/wdeploy">
              <em>wdeploy</em>
            </a>
            <strong>
              <em>?</em>
            </strong>
          </p>
        </blockquote>
        <p>
This is actually pretty easy, but wouldn’t fit into 140 characters, so I decided to
blog it. 
</p>
        <p>
One thing to know is that when you publish from Visual Studio, by default we use the
MSDeploy (AKA Web Deployment Tool) Object Model in order to perform the deployment.
We do this for performance and other reasons. Because of this there is no real msdeploy.exe
command that is being issued. You can however change that behavior. This is controlled
by an MSBuild property <strong>UseMSDeployExe</strong> which is false by default.
In this case since <a href="http://twitter.com/troyahunt">Troy</a> wants to see the
command we will need to set that property to false. There are 2 ways in which you
can do this. You can set it in the project file itself, or you can define it in a
.wpp.targets file. I would recommend the second approach. What you need to do is to
create a file with the name {ProjectName}.wpp.targets in the same directory as the
project where {ProjectName} is the name of the Web Application Project (WAP). When
you do this, during a build or publish the file is automatically imported into the
build process. In my example I have a WAP named WebApplication1.csproj, so I created
the file WebApplication1.wpp.targets and its contents are shown below.
</p>
        <pre class="brush: xml;">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;Project ToolsVersion="4.0" DefaultTargets="Build" 
         xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
  &lt;PropertyGroup&gt;
    &lt;UseMsdeployExe&gt;true&lt;/UseMsdeployExe&gt;
  &lt;/PropertyGroup&gt;
&lt;/Project&gt;</pre>
        <p>
In the snippet above you can see that I defined the property to true. Now there is
one more thing to do, publish the project. Once you publish the project, in the output
window you will see the MSDeploy command which is being used. In my case I published
the project to <strong><em>localhost</em></strong> to the <strong><em>Default Web
Site/Test01</em></strong> application path. You may have to copy the text from the
output window into Notepad and search for msdeploy.exe. The command that was issued
in my case is shown below (<em>with formatting changes for readability</em>).
</p>
        <pre class="brush: plain;">"C:\Program Files (x86)\IIS\Microsoft Web Deploy\msdeploy.exe" 
-source:manifest='C:\temp\_NET\ThrowAway\WebApplication3\WebApplication1\obj\Debug\Package\WebApplication1.SourceManifest.xml' 
-dest:auto,IncludeAcls='False',AuthType='NTLM' 
-verb:sync 
-enableRule:DoNotDeleteRule 
-disableLink:AppPoolExtension 
-disableLink:ContentExtension 
-disableLink:CertificateExtension 
-setParam:kind='ProviderPath',
    scope='IisApp',match='^C:\\temp\\_NET\\ThrowAway\\WebApplication3\\WebApplication1\\obj\\Debug\\Package\\PackageTmp$',
    value='Default Web Site/Test01' 
-setParam:kind='ProviderPath',
    scope='setAcl',
    match='^C:\\temp\\_NET\\ThrowAway\\WebApplication3\\WebApplication1\\obj\\Debug\\Package\\PackageTmp$',
    value='Default Web Site/Test01' 
-retryAttempts=2 </pre>
        <p>
So that’s it, pretty simple.
</p>
        <p>
FYI, if you want more detail you can increase the MSBuild Output Window verbosity
by going to Tools-&gt;Options-&gt;Projects and Solutions-&gt;Build and Run then specifying
a different value for <strong><em>MSBuild project build output verbosity</em></strong>.
</p>
        <p>
Sayed Ibrahim Hashimi - <a href="http://twitter.com/sayedihashimi">@sayedihashimi</a></p>
      </body>
      <title>Web Deploy: How to see the command executed in Visual Studio during publish</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,269ec8d3-9d71-400a-bd99-cc3ea5d0c834.aspx</guid>
      <link>http://sedodream.com/2010/11/04/WebDeployHowToSeeTheCommandExecutedInVisualStudioDuringPublish.aspx</link>
      <pubDate>Thu, 04 Nov 2010 04:03:26 GMT</pubDate>
      <description>&lt;p&gt;
I just saw a post on &lt;a href="http://twitter.com/#!/troyahunt/status/29612666076"&gt;twitter&lt;/a&gt; asking
the question
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;strong&gt;&lt;em&gt;Is there any easy way to see the underlying MSBuild command when building
in VS2010? Want to see the MSDeploy params. @&lt;/em&gt;&lt;/strong&gt;&lt;a href="http://twitter.com/wdeploy"&gt;&lt;em&gt;wdeploy&lt;/em&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;?&lt;/em&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
This is actually pretty easy, but wouldn’t fit into 140 characters, so I decided to
blog it. 
&lt;/p&gt;
&lt;p&gt;
One thing to know is that when you publish from Visual Studio, by default we use the
MSDeploy (AKA Web Deployment Tool) Object Model in order to perform the deployment.
We do this for performance and other reasons. Because of this there is no real msdeploy.exe
command that is being issued. You can however change that behavior. This is controlled
by an MSBuild property &lt;strong&gt;UseMSDeployExe&lt;/strong&gt; which is false by default.
In this case since &lt;a href="http://twitter.com/troyahunt"&gt;Troy&lt;/a&gt; wants to see the
command we will need to set that property to false. There are 2 ways in which you
can do this. You can set it in the project file itself, or you can define it in a
.wpp.targets file. I would recommend the second approach. What you need to do is to
create a file with the name {ProjectName}.wpp.targets in the same directory as the
project where {ProjectName} is the name of the Web Application Project (WAP). When
you do this, during a build or publish the file is automatically imported into the
build process. In my example I have a WAP named WebApplication1.csproj, so I created
the file WebApplication1.wpp.targets and its contents are shown below.
&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 ToolsVersion=&amp;quot;4.0&amp;quot; DefaultTargets=&amp;quot;Build&amp;quot; 
         xmlns=&amp;quot;http://schemas.microsoft.com/developer/msbuild/2003&amp;quot;&amp;gt;
  &amp;lt;PropertyGroup&amp;gt;
    &amp;lt;UseMsdeployExe&amp;gt;true&amp;lt;/UseMsdeployExe&amp;gt;
  &amp;lt;/PropertyGroup&amp;gt;
&amp;lt;/Project&amp;gt;&lt;/pre&gt;
&lt;p&gt;
In the snippet above you can see that I defined the property to true. Now there is
one more thing to do, publish the project. Once you publish the project, in the output
window you will see the MSDeploy command which is being used. In my case I published
the project to &lt;strong&gt;&lt;em&gt;localhost&lt;/em&gt;&lt;/strong&gt; to the &lt;strong&gt;&lt;em&gt;Default Web
Site/Test01&lt;/em&gt;&lt;/strong&gt; application path. You may have to copy the text from the
output window into Notepad and search for msdeploy.exe. The command that was issued
in my case is shown below (&lt;em&gt;with formatting changes for readability&lt;/em&gt;).
&lt;/p&gt;
&lt;pre class="brush: plain;"&gt;&amp;quot;C:\Program Files (x86)\IIS\Microsoft Web Deploy\msdeploy.exe&amp;quot; 
-source:manifest='C:\temp\_NET\ThrowAway\WebApplication3\WebApplication1\obj\Debug\Package\WebApplication1.SourceManifest.xml' 
-dest:auto,IncludeAcls='False',AuthType='NTLM' 
-verb:sync 
-enableRule:DoNotDeleteRule 
-disableLink:AppPoolExtension 
-disableLink:ContentExtension 
-disableLink:CertificateExtension 
-setParam:kind='ProviderPath',
    scope='IisApp',match='^C:\\temp\\_NET\\ThrowAway\\WebApplication3\\WebApplication1\\obj\\Debug\\Package\\PackageTmp$',
    value='Default Web Site/Test01' 
-setParam:kind='ProviderPath',
    scope='setAcl',
    match='^C:\\temp\\_NET\\ThrowAway\\WebApplication3\\WebApplication1\\obj\\Debug\\Package\\PackageTmp$',
    value='Default Web Site/Test01' 
-retryAttempts=2 &lt;/pre&gt;
&lt;p&gt;
So that’s it, pretty simple.
&lt;/p&gt;
&lt;p&gt;
FYI, if you want more detail you can increase the MSBuild Output Window verbosity
by going to Tools-&amp;gt;Options-&amp;gt;Projects and Solutions-&amp;gt;Build and Run then specifying
a different value for &lt;strong&gt;&lt;em&gt;MSBuild project build output verbosity&lt;/em&gt;&lt;/strong&gt;.
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi - &lt;a href="http://twitter.com/sayedihashimi"&gt;@sayedihashimi&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,269ec8d3-9d71-400a-bd99-cc3ea5d0c834.aspx</comments>
      <category>MSBuild</category>
      <category>MSDeploy</category>
      <category>Web Deployment Tool</category>
      <category>Web Development</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=68b7e248-b9f5-4d07-bdfe-eb037bcf2cbb</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,68b7e248-b9f5-4d07-bdfe-eb037bcf2cbb.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,68b7e248-b9f5-4d07-bdfe-eb037bcf2cbb.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=68b7e248-b9f5-4d07-bdfe-eb037bcf2cbb</wfw:commentRss>
      <slash:comments>6</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <strong>
            <u>Warning: What you see below feels hacky to me, but if you find it useful
then use it</u>
          </strong>
        </p>
        <p>
I have heard a lot of questions and confusion regarding web.debug.config and web.release.config.
For example here is just <a href="http://stackoverflow.com/q/3922291/105999">one question
on StackOverflow</a>. The question states:
</p>
        <pre class="brush: plain;">Hello, I want to use the web.config transformation that works fine for publish also for debugging.

When i publish a web app, visual studio automatically transforms the web.config based on my </pre>
        <pre class="brush: plain;">current build configuration. How can i tell visual studio </pre>
        <pre class="brush: plain;">to do the same when i start debugging. On debug start it simply </pre>
        <pre class="brush: plain;">uses the default web.config without transformation.

Any idea?</pre>
        <p>
First let me explain, as I did to that question, the purpose of the files: web.config/web.debug.config/web.release.config. 
</p>
        <p>
          <strong>
            <u>web.config</u>
          </strong>
        </p>
        <p>
This is the config file which developers should use locally. Ideally you should get
this to be standardized. For instance you could use localhost for DB strings, and
what not. You should strive for this to work on dev machines without changes. 
</p>
        <p>
          <strong>
            <u>web.debug.config </u>
          </strong>
        </p>
        <p>
This is the transform that is applied when you publish your application to the development
staging environment. This would make changes to the web.config which are required
for the target environment.
</p>
        <p>
          <strong>
            <u>web.release.config</u>
          </strong>
        </p>
        <p>
This is the transform that is applied when you publish your application to the "production"
environment. Obviously you'll have to be careful with passwords depending on your
application/team.
</p>
        <p>
The problem with transforming the web.config that you are currently running is that
a transform can perform destructive actions to the web.config. For example it may
delete a attributes, delete elements, etc.
</p>
        <h4>Resolution
</h4>
        <p>
Ok, with that out the way not let’s see how we can enable what the question asker
wants to do. To recap, when he builds on a particular configuration he wants a specific
transform to be applied to web.config. So obviously you do not want to maintain a
web.config file, because it is going to be overwritten. So what we need to do is to
create a new file web.template.config, which is just a copy of web.config. Then just
delete web.config by using Windows Explorer (don’t delete using Visual Studio because
we do not want to delete it from the project). <em>Note: If you are using a source
control provider which is integrated into Visual Studio then you probably want to
delete web.config from source control.</em> Also with this we do not want to use web.debug.config
or web.release.config because these already have a well defined role in the Web Publishing
Pipeline so we do not want to disturb that. So instead we will create two new files,
in the same folder as the project and web.template.config, web.dev.debug.config and
web.dev.release.config. The ideas is that these will be the transforms applied when
you debug, or run, your application from Visual Studio. Now we need to hook into the
build/package/publish process to get this all wired up. With Web Application Projects
(WAP) there is an extensibility point that you can create a project file in the same
folder with the name {ProjectName}.wpp.targets where {ProjectName} is the name of
the project. If this file is on disk in the same folder as the WAP then it will automatically
be imported into the project file. So I have created this file. And I have placed
the following content:
</p>
        <pre class="brush: xml;">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;

  &lt;!-- Make sure web.config will be there even for package/publish --&gt;
  &lt;Target Name="CopyWebTemplateConfig" BeforeTargets="Build"&gt;
    &lt;Copy SourceFiles="web.template.config"
          DestinationFiles="web.config"/&gt;
  &lt;/Target&gt;
  
  &lt;PropertyGroup&gt;
    &lt;PrepareForRunDependsOn&gt;
      $(PrepareForRunDependsOn);
      UpdateWebConfigBeforeRun;
    &lt;/PrepareForRunDependsOn&gt;
  &lt;/PropertyGroup&gt;

  &lt;!-- This target will run right before you run your app in Visual Studio --&gt;
  &lt;Target Name="UpdateWebConfigBeforeRun"&gt;
    &lt;Message Text="Configuration: $(Configuration): web.dev.$(Configuration).config"/&gt;
    &lt;TransformXml Source="web.template.config"
              Transform="web.dev.$(Configuration).config"
              Destination="web.config" /&gt;
  &lt;/Target&gt;

  &lt;!-- Exclude the config template files from the created package --&gt;
  &lt;Target Name="ExcludeCustomConfigTransformFiles" BeforeTargets="ExcludeFilesFromPackage"&gt;
    &lt;ItemGroup&gt;
      &lt;ExcludeFromPackageFiles Include="web.template.config;web.dev.*.config"/&gt;
    &lt;/ItemGroup&gt;
    &lt;Message Text="ExcludeFromPackageFiles: @(ExcludeFromPackageFiles)" Importance="high"/&gt;
  &lt;/Target&gt;
&lt;/Project&gt;</pre>
        <p>
Let me explain this a bit. I have created the CopyWebTemplateConfig target which will
always copy web.template.config to web.config on build, even if you are not debugging
your application in Visual Studio. This is needed because we still need to support
the package/publish process of Visual Studio. Then I extended the property PrepareForRunDependsOn
to include the UpdateWebConfigBeforeRun target. This property is used to identify
the list of targets which needs to be executed before any managed project is run from
Visual Studio. In this target I am using the TransformXml task to transform web.template.config,
using the correct web.dev.***.config file. After that your app starts up using the
correct web.config based on  your build configuration.
</p>
        <p>
After that I have another target ExcludeCustomConfigTransformsFiles, which I inject
into the package/publish process via the attribute <strong>BeforeTargets=”ExcludeFilesFromPackage”</strong>.
This is needed because we do not want these files to be included when the application
is packaged or published.
</p>
        <p>
So that is really all there is to it. To explain the package/publish process a bit
more for this scenario. When you package/publish web.debug.config or web.release.config,
depending on build configuration, will still be used. But ultimately the file that
it is transforming is web.template.config, so you may have to adjust depending on
what you have in that file. Questions/Comments?
</p>
        <p>
Sayed Ibrahim Hashimi - <a href="http://twitter.com/sayedihashimi">@sayedihashimi</a></p>
      </body>
      <title>ASP.NET Web Projects: web.debug.config &amp; web.release.config</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,68b7e248-b9f5-4d07-bdfe-eb037bcf2cbb.aspx</guid>
      <link>http://sedodream.com/2010/10/21/ASPNETWebProjectsWebdebugconfigWebreleaseconfig.aspx</link>
      <pubDate>Thu, 21 Oct 2010 06:13:26 GMT</pubDate>
      <description>&lt;p&gt;
&lt;strong&gt;&lt;u&gt;Warning: What you see below feels hacky to me, but if you find it useful
then use it&lt;/u&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
I have heard a lot of questions and confusion regarding web.debug.config and web.release.config.
For example here is just &lt;a href="http://stackoverflow.com/q/3922291/105999"&gt;one question
on StackOverflow&lt;/a&gt;. The question states:
&lt;/p&gt;
&lt;pre class="brush: plain;"&gt;Hello, I want to use the web.config transformation that works fine for publish also for debugging.

When i publish a web app, visual studio automatically transforms the web.config based on my &lt;/pre&gt;
&lt;pre class="brush: plain;"&gt;current build configuration. How can i tell visual studio &lt;/pre&gt;
&lt;pre class="brush: plain;"&gt;to do the same when i start debugging. On debug start it simply &lt;/pre&gt;
&lt;pre class="brush: plain;"&gt;uses the default web.config without transformation.

Any idea?&lt;/pre&gt;
&lt;p&gt;
First let me explain, as I did to that question, the purpose of the files: web.config/web.debug.config/web.release.config. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;u&gt;web.config&lt;/u&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
This is the config file which developers should use locally. Ideally you should get
this to be standardized. For instance you could use localhost for DB strings, and
what not. You should strive for this to work on dev machines without changes. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;u&gt;web.debug.config &lt;/u&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
This is the transform that is applied when you publish your application to the development
staging environment. This would make changes to the web.config which are required
for the target environment.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;u&gt;web.release.config&lt;/u&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
This is the transform that is applied when you publish your application to the &amp;quot;production&amp;quot;
environment. Obviously you'll have to be careful with passwords depending on your
application/team.
&lt;/p&gt;
&lt;p&gt;
The problem with transforming the web.config that you are currently running is that
a transform can perform destructive actions to the web.config. For example it may
delete a attributes, delete elements, etc.
&lt;/p&gt;
&lt;h4&gt;Resolution
&lt;/h4&gt;
&lt;p&gt;
Ok, with that out the way not let’s see how we can enable what the question asker
wants to do. To recap, when he builds on a particular configuration he wants a specific
transform to be applied to web.config. So obviously you do not want to maintain a
web.config file, because it is going to be overwritten. So what we need to do is to
create a new file web.template.config, which is just a copy of web.config. Then just
delete web.config by using Windows Explorer (don’t delete using Visual Studio because
we do not want to delete it from the project). &lt;em&gt;Note: If you are using a source
control provider which is integrated into Visual Studio then you probably want to
delete web.config from source control.&lt;/em&gt; Also with this we do not want to use web.debug.config
or web.release.config because these already have a well defined role in the Web Publishing
Pipeline so we do not want to disturb that. So instead we will create two new files,
in the same folder as the project and web.template.config, web.dev.debug.config and
web.dev.release.config. The ideas is that these will be the transforms applied when
you debug, or run, your application from Visual Studio. Now we need to hook into the
build/package/publish process to get this all wired up. With Web Application Projects
(WAP) there is an extensibility point that you can create a project file in the same
folder with the name {ProjectName}.wpp.targets where {ProjectName} is the name of
the project. If this file is on disk in the same folder as the WAP then it will automatically
be imported into the project file. So I have created this file. And I have placed
the following content:
&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 ToolsVersion=&amp;quot;4.0&amp;quot; xmlns=&amp;quot;http://schemas.microsoft.com/developer/msbuild/2003&amp;quot;&amp;gt;

  &amp;lt;!-- Make sure web.config will be there even for package/publish --&amp;gt;
  &amp;lt;Target Name=&amp;quot;CopyWebTemplateConfig&amp;quot; BeforeTargets=&amp;quot;Build&amp;quot;&amp;gt;
    &amp;lt;Copy SourceFiles=&amp;quot;web.template.config&amp;quot;
          DestinationFiles=&amp;quot;web.config&amp;quot;/&amp;gt;
  &amp;lt;/Target&amp;gt;
  
  &amp;lt;PropertyGroup&amp;gt;
    &amp;lt;PrepareForRunDependsOn&amp;gt;
      $(PrepareForRunDependsOn);
      UpdateWebConfigBeforeRun;
    &amp;lt;/PrepareForRunDependsOn&amp;gt;
  &amp;lt;/PropertyGroup&amp;gt;

  &amp;lt;!-- This target will run right before you run your app in Visual Studio --&amp;gt;
  &amp;lt;Target Name=&amp;quot;UpdateWebConfigBeforeRun&amp;quot;&amp;gt;
    &amp;lt;Message Text=&amp;quot;Configuration: $(Configuration): web.dev.$(Configuration).config&amp;quot;/&amp;gt;
    &amp;lt;TransformXml Source=&amp;quot;web.template.config&amp;quot;
              Transform=&amp;quot;web.dev.$(Configuration).config&amp;quot;
              Destination=&amp;quot;web.config&amp;quot; /&amp;gt;
  &amp;lt;/Target&amp;gt;

  &amp;lt;!-- Exclude the config template files from the created package --&amp;gt;
  &amp;lt;Target Name=&amp;quot;ExcludeCustomConfigTransformFiles&amp;quot; BeforeTargets=&amp;quot;ExcludeFilesFromPackage&amp;quot;&amp;gt;
    &amp;lt;ItemGroup&amp;gt;
      &amp;lt;ExcludeFromPackageFiles Include=&amp;quot;web.template.config;web.dev.*.config&amp;quot;/&amp;gt;
    &amp;lt;/ItemGroup&amp;gt;
    &amp;lt;Message Text=&amp;quot;ExcludeFromPackageFiles: @(ExcludeFromPackageFiles)&amp;quot; Importance=&amp;quot;high&amp;quot;/&amp;gt;
  &amp;lt;/Target&amp;gt;
&amp;lt;/Project&amp;gt;&lt;/pre&gt;
&lt;p&gt;
Let me explain this a bit. I have created the CopyWebTemplateConfig target which will
always copy web.template.config to web.config on build, even if you are not debugging
your application in Visual Studio. This is needed because we still need to support
the package/publish process of Visual Studio. Then I extended the property PrepareForRunDependsOn
to include the UpdateWebConfigBeforeRun target. This property is used to identify
the list of targets which needs to be executed before any managed project is run from
Visual Studio. In this target I am using the TransformXml task to transform web.template.config,
using the correct web.dev.***.config file. After that your app starts up using the
correct web.config based on&amp;#160; your build configuration.
&lt;/p&gt;
&lt;p&gt;
After that I have another target ExcludeCustomConfigTransformsFiles, which I inject
into the package/publish process via the attribute &lt;strong&gt;BeforeTargets=”ExcludeFilesFromPackage”&lt;/strong&gt;.
This is needed because we do not want these files to be included when the application
is packaged or published.
&lt;/p&gt;
&lt;p&gt;
So that is really all there is to it. To explain the package/publish process a bit
more for this scenario. When you package/publish web.debug.config or web.release.config,
depending on build configuration, will still be used. But ultimately the file that
it is transforming is web.template.config, so you may have to adjust depending on
what you have in that file. Questions/Comments?
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi - &lt;a href="http://twitter.com/sayedihashimi"&gt;@sayedihashimi&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,68b7e248-b9f5-4d07-bdfe-eb037bcf2cbb.aspx</comments>
      <category>MSBuild</category>
      <category>MSDeploy</category>
      <category>Web Publishing Pipeline</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=27dcfa0d-f88c-4dc3-ace1-0e0d7ef75c1f</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,27dcfa0d-f88c-4dc3-ace1-0e0d7ef75c1f.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,27dcfa0d-f88c-4dc3-ace1-0e0d7ef75c1f.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=27dcfa0d-f88c-4dc3-ace1-0e0d7ef75c1f</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Last week on <a href="http://stackoverflow.com">StackOverflow</a> I answered a question, <a href="http://stackoverflow.com/q/3613714/105999">Make
web.config transformations working locally</a> and in a response to my answer the
question asker asked me if I would be able to a question he posed earlier <a href="http://stackoverflow.com/q/2915329/105999">Advanced
tasks using web.config transformation</a>. Evidently <a href="http://stackoverflow.com/users/80268/diego-c">he</a> is
really interested in config transformations! I don’t blame him, I’m really into them
as well.
</p>
        <p>
In his question he asks (summarizing) can we replace portions of attribute values
instead of this entire attribute? So for instance you have the following in your web.config.
Below is two sets of appSettings one from Dev and the other from Prod (taken from
the original question).
</p>
        <pre class="brush: xml;">&lt;!-- DEV ENTRY --&gt;
&lt;appSettings&gt;
 &lt;add key="serviceName1_WebsService_Url" value="http://wsServiceName1.dev.domain.com/v1.2.3.4/entryPoint.asmx" /&gt;
 &lt;add key="serviceName2_WebsService_Url" value="http://ma1-lab.lab1.domain.com/v1.2.3.4/entryPoint.asmx" /&gt;
&lt;/appSettings&gt;

&lt;!-- PROD ENTRY --&gt;
&lt;appSettings&gt;
 &lt;add key="serviceName1_WebsService_Url" value="http://wsServiceName1.prod.domain.com/v1.2.3.4/entryPoint.asmx" /&gt;
 &lt;add key="serviceName2_WebsService_Url" value="http://ws.ServiceName2.domain.com/v1.2.3.4/entryPoint.asmx" /&gt;
&lt;/appSettings&gt;</pre>
        <p>
In the above we just want to replace dev with prod and ma1-lab.lab1.domain with ws.ServiceName2.domain.
For those wondering currently we have the following transformations out of the box.
</p>
        <ul>
          <li>
Replace – Replaces the entire element</li>
          <li>
Remove – Removes the entire element</li>
          <li>
RemoveAll – Removes all matching elements</li>
          <li>
Insert – Inserts an element</li>
          <li>
SetAttributes – Sets the value of the specified attributes</li>
          <li>
RemoveAttributes – Removes attributes</li>
          <li>
InsertAfter – Inserts an element after another</li>
          <li>
InsertBefore – Inserts an element before another</li>
        </ul>
        <p>
At the end of this article I’ve linked to another blog which has more info about these
transformations. So it sounds like SetAttributes is <strong>almost</strong> what we
want, but not quite what there. A little known fact is that you can create your own
config transformations and use those. In fact all of the out of the box transformations
follow the same patterns that custom transformations would. To solve this issue we
need to create our own config transformation, AttributeRegexReplace. This transformation
will take an attribute value and do a <a href="http://en.wikipedia.org/wiki/Regular_expression">regular
expression</a> replace on its value. In order to create a new transformation you first
reference the Microsoft.Web.Publishing.Tasks.dll which can be found in the <strong>%Program
Files (x86)%MSBuild\Microsoft\VisualStudio\v10.0\Web</strong> folder. If you are working
with a team it is best if you copy that assembly, place it in a shared folder in source
control, and make the reference from that location. After you create the reference
to that assembly you will need to create a class which extends the Transform class.
The class diagram for this abstract class is shown below.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/WindowsLiveWriter/ExtendingXMLw.configConfigtransformation_12D90/image_2.png">
            <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" alt="image" src="http://sedodream.com/content/binary/WindowsLiveWriter/ExtendingXMLw.configConfigtransformation_12D90/image_thumb.png" width="455" border="0" height="394" />
          </a>
        </p>
        <p>
The only thing that you will need to implement is the Apply method. You don’t even
need to fully understand all of the properties and methods just the portions that
you are interested in. Here we will not cover all the details of this class, or other
related classes which exist, but there will be future posts which will shed more light
on this area.
</p>
        <p>
In the sample class library that I created, I called the project CustomTransformType.
Inside of that project I created the class AttributeRegexReplace. The entire contents
of that class are shown below, we will go over the details after that.
</p>
        <pre class="brush: csharp;">namespace CustomTransformType
{
    using System;
    using System.Text.RegularExpressions;
    using System.Xml;
    using Microsoft.Web.Publishing.Tasks;

    public class AttributeRegexReplace : Transform
    {
        private string pattern;
        private string replacement;
        private string attributeName;

        protected string AttributeName
        {
            get
            {
                if (this.attributeName == null)
                {
                    this.attributeName = this.GetArgumentValue("Attribute");
                }
                return this.attributeName;
            }
        }
        protected string Pattern
        {
            get
            {
                if (this.pattern == null)
                {
                    this.pattern = this.GetArgumentValue("Pattern");
                }

                return pattern;
            }
        }

        protected string Replacement
        {
            get
            {
                if (this.replacement == null)
                {
                    this.replacement = this.GetArgumentValue("Replacement");
                }

                return replacement;
            }
        }

        protected string GetArgumentValue(string name)
        {
            // this extracts a value from the arguments provided
            if (string.IsNullOrWhiteSpace(name)) 
            { throw new ArgumentNullException("name"); }

            string result = null;
            if (this.Arguments != null &amp;&amp; this.Arguments.Count &gt; 0)
            {
                foreach (string arg in this.Arguments)
                {
                    if (!string.IsNullOrWhiteSpace(arg))
                    {
                        string trimmedArg = arg.Trim();
                        if (trimmedArg.ToUpperInvariant().StartsWith(name.ToUpperInvariant()))
                        {
                            int start = arg.IndexOf('\'');
                            int last = arg.LastIndexOf('\'');
                            if (start &lt;= 0 || last &lt;= 0 || last &lt;= 0)
                            {
                                throw new ArgumentException("Expected two ['] characters");
                            }

                            string value = trimmedArg.Substring(start, last - start);
                            if (value != null)
                            {
                                // remove any leading or trailing '
                                value = value.Trim().TrimStart('\'').TrimStart('\'');
                            }
                            result = value;
                        }
                    }
                }
            }
            return result;
        }

        protected override void Apply()
        {
            foreach (XmlAttribute att in this.TargetNode.Attributes)
            {
                if (string.Compare(att.Name, this.AttributeName, StringComparison.InvariantCultureIgnoreCase) == 0)
                {
                    // get current value, perform the Regex
                    att.Value = Regex.Replace(att.Value, this.Pattern, this.Replacement);
                }
            }
        }
    }
}</pre>
        <p>
In this class we have 3 properties; Pattern, Replacement, and AttributeName. All of
these values will be provided via an argument in the config transformation. For example
take a look at the element below which contains a transform attribute may look like
the following.
</p>
        <pre class="brush: csharp;">&lt;add key="two" value="two-replaced" 
         xdt:Transform="AttributeRegexReplace(Attribute='value', Pattern='here',Replacement='REPLACED')" 
         xdt:Locator="Match(key)"/&gt;</pre>
        <p>
In this example I declare that I am using AttributeRegexReplace and then specify the
values for the attributes within the <strong>()</strong>. In the class above I have
a method, GetArgumentValue, which is used to parse values from that argument string.
When your transform is invoked the string inside of () is passed in as the ArgumentString
value. If you are using a <strong>,</strong> as the argument separator, as I am, then
you can use the Arguments list. Which will split up the arguments by the <strong>,</strong> character.
Surprisingly in the 101 lines of code in the sample there are only a few interesting
lines. Those are what’s contained inside the Apply method. Inside that method I search
the TargetNode’s attributes (<em>TargetNode is the node which was matched in the xml
file being transformed</em>) for an attribute with the same name as the one specified
in the AttributeName property. Once I find it I just make a call to <a href="http://msdn.microsoft.com/en-us/library/e7f5w83z.aspx">Regex.Replace</a> to
get the new value, and assign it. Pretty simple! Now lets see how can we use this.
</p>
        <p>
Let’s say you have the following very simple web.config
</p>
        <pre class="brush: xml;">&lt;?xml version="1.0"?&gt;
&lt;configuration&gt;
  &lt;appSettings&gt;
    &lt;add key="one" value="one"/&gt;
    &lt;add key="two" value="partial-replace-here-end"/&gt;
    &lt;add key="three" value="three here"/&gt;
  &lt;/appSettings&gt;
&lt;/configuration&gt;</pre>
        <p>
If we want to be able to use our own transform then we will have to use the xdt:Import
element. You can place that element inside the xml document anywhere immediately under
the root element. This element will allow us to utilize our own transform class. It
only has 3 possible attributes.
</p>
        <ul>
          <li>
namespace – This is the namespace which the transform is contained in 
</li>
          <li>
path – This is the full path to the assembly</li>
          <li>
assembly – This is the assembly name which contains the transform</li>
        </ul>
        <p>
You can only use one of the two; path and assembly. Basically it boils down to how
the assembly is loaded. If you use path the assembly will be loaded with <a href="http://msdn.microsoft.com/en-us/library/system.reflection.assembly.loadfrom.aspx">Assembly.LoadFrom</a> and
if you chose to use assembly passing in the <a href="http://msdn.microsoft.com/en-us/library/system.reflection.assemblyname.aspx">AssemblyName</a>,
for instance if the assembly in in the GAC, then it will be loaded using <a href="http://msdn.microsoft.com/en-us/library/system.reflection.assembly.load.aspx">Assembly.Load</a>.
</p>
        <p>
I chose to use path, because I just placed the file inside of the MSBuild Extensions
directory (<strong>%Program Files (x86)%MSBuild</strong>) in a folder named Custom.
Then I created my config transform file to be the following.
</p>
        <pre class="brush: xml;">&lt;?xml version="1.0"?&gt;

&lt;configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"&gt;
                        
  &lt;xdt:Import path="C:\Program Files (x86)\MSBuild\Custom\CustomTransformType.dll"
              namespace="CustomTransformType" /&gt;

  &lt;appSettings&gt;
    &lt;add key="one" value="one-replaced" xdt:Transform="Replace" xdt:Locator="Match(key)" /&gt;
    &lt;add key="two" value="two-replaced" xdt:Transform="AttributeRegexReplace(Attribute='value', Pattern='here',Replacement='REPLACED')" xdt:Locator="Match(key)"/&gt;
  &lt;/appSettings&gt;
&lt;/configuration&gt;</pre>
        <p>
Then to run this I created an MSBuild file, PerformTransform.proj, which is shown
below.
</p>
        <pre class="brush: xml;">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;Project ToolsVersion="4.0" DefaultTargets="Demo" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
  &lt;UsingTask TaskName="TransformXml"
           AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll"/&gt;

  &lt;PropertyGroup&gt;
    &lt;TransformDest&gt;web.tranzed.config&lt;/TransformDest&gt;
  &lt;/PropertyGroup&gt;
  
  &lt;Target Name="Demo"&gt;
    &lt;Delete Files="$(TransformDest)" /&gt;
    &lt;TransformXml Source="web.config"
                  Transform="web.dev.config"
                  Destination="$(TransformDest)" /&gt;                  
  &lt;/Target&gt;
  
&lt;/Project&gt;</pre>
        <p>
This file uses the TransformXml task as I outlined in a previous post <a href="http://sedodream.com/2010/04/26/ConfigTransformationsOutsideOfWebAppBuilds.aspx">Config
transformations outside of web app builds</a>. Once you execute the Demo target with
the command msbuild PerformTransform.proj /t:Demo you will see the file web.tranzed.config
with the following contents.
</p>
        <pre class="brush: xml;">&lt;?xml version="1.0"?&gt;
&lt;configuration&gt;
  &lt;appSettings&gt;
    &lt;add key="one" value="one-replaced"/&gt;
    &lt;add key="two" value="partial-replace-REPLACED-end"/&gt;
    &lt;add key="three" value="three here"/&gt;
  &lt;/appSettings&gt;
&lt;/configuration&gt;</pre>
        <p>
So you can see that the replacement did occur as we intended. Below you will find
the download link for the samples as well as another blog entry for more info on the
out of the box transformations.
</p>
        <p>
          <strong>Resources</strong>
        </p>
        <ul>
          <li>
Source download at: <a title="http://sedotech.com/Content/samples/CustomTransformType.zip" href="http://sedotech.com/Content/samples/CustomTransformType.zip">http://sedotech.com/Content/samples/CustomTransformType.zip</a></li>
          <li>
More info on out of box transforms at: <a title="http://vishaljoshi.blogspot.com/2009/03/web-deployment-webconfig-transformation_23.html" href="http://vishaljoshi.blogspot.com/2009/03/web-deployment-webconfig-transformation_23.html">http://vishaljoshi.blogspot.com/2009/03/web-deployment-webconfig-transformation_23.html</a></li>
        </ul>
        <p>
Sayed Ibrahim Hashimi
</p>
      </body>
      <title>Extending XML (web.config) Config transformation</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,27dcfa0d-f88c-4dc3-ace1-0e0d7ef75c1f.aspx</guid>
      <link>http://sedodream.com/2010/09/09/ExtendingXMLWebconfigConfigTransformation.aspx</link>
      <pubDate>Thu, 09 Sep 2010 05:51:43 GMT</pubDate>
      <description>&lt;p&gt;
Last week on &lt;a href="http://stackoverflow.com"&gt;StackOverflow&lt;/a&gt; I answered a question, &lt;a href="http://stackoverflow.com/q/3613714/105999"&gt;Make
web.config transformations working locally&lt;/a&gt; and in a response to my answer the
question asker asked me if I would be able to a question he posed earlier &lt;a href="http://stackoverflow.com/q/2915329/105999"&gt;Advanced
tasks using web.config transformation&lt;/a&gt;. Evidently &lt;a href="http://stackoverflow.com/users/80268/diego-c"&gt;he&lt;/a&gt; is
really interested in config transformations! I don’t blame him, I’m really into them
as well.
&lt;/p&gt;
&lt;p&gt;
In his question he asks (summarizing) can we replace portions of attribute values
instead of this entire attribute? So for instance you have the following in your web.config.
Below is two sets of appSettings one from Dev and the other from Prod (taken from
the original question).
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;!-- DEV ENTRY --&amp;gt;
&amp;lt;appSettings&amp;gt;
 &amp;lt;add key="serviceName1_WebsService_Url" value="http://wsServiceName1.dev.domain.com/v1.2.3.4/entryPoint.asmx" /&amp;gt;
 &amp;lt;add key="serviceName2_WebsService_Url" value="http://ma1-lab.lab1.domain.com/v1.2.3.4/entryPoint.asmx" /&amp;gt;
&amp;lt;/appSettings&amp;gt;

&amp;lt;!-- PROD ENTRY --&amp;gt;
&amp;lt;appSettings&amp;gt;
 &amp;lt;add key="serviceName1_WebsService_Url" value="http://wsServiceName1.prod.domain.com/v1.2.3.4/entryPoint.asmx" /&amp;gt;
 &amp;lt;add key="serviceName2_WebsService_Url" value="http://ws.ServiceName2.domain.com/v1.2.3.4/entryPoint.asmx" /&amp;gt;
&amp;lt;/appSettings&amp;gt;&lt;/pre&gt;
&lt;p&gt;
In the above we just want to replace dev with prod and ma1-lab.lab1.domain with ws.ServiceName2.domain.
For those wondering currently we have the following transformations out of the box.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Replace – Replaces the entire element&lt;/li&gt;
&lt;li&gt;
Remove – Removes the entire element&lt;/li&gt;
&lt;li&gt;
RemoveAll – Removes all matching elements&lt;/li&gt;
&lt;li&gt;
Insert – Inserts an element&lt;/li&gt;
&lt;li&gt;
SetAttributes – Sets the value of the specified attributes&lt;/li&gt;
&lt;li&gt;
RemoveAttributes – Removes attributes&lt;/li&gt;
&lt;li&gt;
InsertAfter – Inserts an element after another&lt;/li&gt;
&lt;li&gt;
InsertBefore – Inserts an element before another&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
At the end of this article I’ve linked to another blog which has more info about these
transformations. So it sounds like SetAttributes is &lt;strong&gt;almost&lt;/strong&gt; what we
want, but not quite what there. A little known fact is that you can create your own
config transformations and use those. In fact all of the out of the box transformations
follow the same patterns that custom transformations would. To solve this issue we
need to create our own config transformation, AttributeRegexReplace. This transformation
will take an attribute value and do a &lt;a href="http://en.wikipedia.org/wiki/Regular_expression"&gt;regular
expression&lt;/a&gt; replace on its value. In order to create a new transformation you first
reference the Microsoft.Web.Publishing.Tasks.dll which can be found in the &lt;strong&gt;%Program
Files (x86)%MSBuild\Microsoft\VisualStudio\v10.0\Web&lt;/strong&gt; folder. If you are working
with a team it is best if you copy that assembly, place it in a shared folder in source
control, and make the reference from that location. After you create the reference
to that assembly you will need to create a class which extends the Transform class.
The class diagram for this abstract class is shown below.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/WindowsLiveWriter/ExtendingXMLw.configConfigtransformation_12D90/image_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" alt="image" src="http://sedodream.com/content/binary/WindowsLiveWriter/ExtendingXMLw.configConfigtransformation_12D90/image_thumb.png" width="455" border="0" height="394"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
The only thing that you will need to implement is the Apply method. You don’t even
need to fully understand all of the properties and methods just the portions that
you are interested in. Here we will not cover all the details of this class, or other
related classes which exist, but there will be future posts which will shed more light
on this area.
&lt;/p&gt;
&lt;p&gt;
In the sample class library that I created, I called the project CustomTransformType.
Inside of that project I created the class AttributeRegexReplace. The entire contents
of that class are shown below, we will go over the details after that.
&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;namespace CustomTransformType
{
    using System;
    using System.Text.RegularExpressions;
    using System.Xml;
    using Microsoft.Web.Publishing.Tasks;

    public class AttributeRegexReplace : Transform
    {
        private string pattern;
        private string replacement;
        private string attributeName;

        protected string AttributeName
        {
            get
            {
                if (this.attributeName == null)
                {
                    this.attributeName = this.GetArgumentValue("Attribute");
                }
                return this.attributeName;
            }
        }
        protected string Pattern
        {
            get
            {
                if (this.pattern == null)
                {
                    this.pattern = this.GetArgumentValue("Pattern");
                }

                return pattern;
            }
        }

        protected string Replacement
        {
            get
            {
                if (this.replacement == null)
                {
                    this.replacement = this.GetArgumentValue("Replacement");
                }

                return replacement;
            }
        }

        protected string GetArgumentValue(string name)
        {
            // this extracts a value from the arguments provided
            if (string.IsNullOrWhiteSpace(name)) 
            { throw new ArgumentNullException("name"); }

            string result = null;
            if (this.Arguments != null &amp;amp;&amp;amp; this.Arguments.Count &amp;gt; 0)
            {
                foreach (string arg in this.Arguments)
                {
                    if (!string.IsNullOrWhiteSpace(arg))
                    {
                        string trimmedArg = arg.Trim();
                        if (trimmedArg.ToUpperInvariant().StartsWith(name.ToUpperInvariant()))
                        {
                            int start = arg.IndexOf('\'');
                            int last = arg.LastIndexOf('\'');
                            if (start &amp;lt;= 0 || last &amp;lt;= 0 || last &amp;lt;= 0)
                            {
                                throw new ArgumentException("Expected two ['] characters");
                            }

                            string value = trimmedArg.Substring(start, last - start);
                            if (value != null)
                            {
                                // remove any leading or trailing '
                                value = value.Trim().TrimStart('\'').TrimStart('\'');
                            }
                            result = value;
                        }
                    }
                }
            }
            return result;
        }

        protected override void Apply()
        {
            foreach (XmlAttribute att in this.TargetNode.Attributes)
            {
                if (string.Compare(att.Name, this.AttributeName, StringComparison.InvariantCultureIgnoreCase) == 0)
                {
                    // get current value, perform the Regex
                    att.Value = Regex.Replace(att.Value, this.Pattern, this.Replacement);
                }
            }
        }
    }
}&lt;/pre&gt;
&lt;p&gt;
In this class we have 3 properties; Pattern, Replacement, and AttributeName. All of
these values will be provided via an argument in the config transformation. For example
take a look at the element below which contains a transform attribute may look like
the following.
&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;&amp;lt;add key="two" value="two-replaced" 
         xdt:Transform="AttributeRegexReplace(Attribute='value', Pattern='here',Replacement='REPLACED')" 
         xdt:Locator="Match(key)"/&amp;gt;&lt;/pre&gt;
&lt;p&gt;
In this example I declare that I am using AttributeRegexReplace and then specify the
values for the attributes within the &lt;strong&gt;()&lt;/strong&gt;. In the class above I have
a method, GetArgumentValue, which is used to parse values from that argument string.
When your transform is invoked the string inside of () is passed in as the ArgumentString
value. If you are using a &lt;strong&gt;,&lt;/strong&gt; as the argument separator, as I am, then
you can use the Arguments list. Which will split up the arguments by the &lt;strong&gt;,&lt;/strong&gt; character.
Surprisingly in the 101 lines of code in the sample there are only a few interesting
lines. Those are what’s contained inside the Apply method. Inside that method I search
the TargetNode’s attributes (&lt;em&gt;TargetNode is the node which was matched in the xml
file being transformed&lt;/em&gt;) for an attribute with the same name as the one specified
in the AttributeName property. Once I find it I just make a call to &lt;a href="http://msdn.microsoft.com/en-us/library/e7f5w83z.aspx"&gt;Regex.Replace&lt;/a&gt; to
get the new value, and assign it. Pretty simple! Now lets see how can we use this.
&lt;/p&gt;
&lt;p&gt;
Let’s say you have the following very simple web.config
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;?xml version="1.0"?&amp;gt;
&amp;lt;configuration&amp;gt;
  &amp;lt;appSettings&amp;gt;
    &amp;lt;add key="one" value="one"/&amp;gt;
    &amp;lt;add key="two" value="partial-replace-here-end"/&amp;gt;
    &amp;lt;add key="three" value="three here"/&amp;gt;
  &amp;lt;/appSettings&amp;gt;
&amp;lt;/configuration&amp;gt;&lt;/pre&gt;
&lt;p&gt;
If we want to be able to use our own transform then we will have to use the xdt:Import
element. You can place that element inside the xml document anywhere immediately under
the root element. This element will allow us to utilize our own transform class. It
only has 3 possible attributes.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
namespace – This is the namespace which the transform is contained in 
&lt;/li&gt;
&lt;li&gt;
path – This is the full path to the assembly&lt;/li&gt;
&lt;li&gt;
assembly – This is the assembly name which contains the transform&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
You can only use one of the two; path and assembly. Basically it boils down to how
the assembly is loaded. If you use path the assembly will be loaded with &lt;a href="http://msdn.microsoft.com/en-us/library/system.reflection.assembly.loadfrom.aspx"&gt;Assembly.LoadFrom&lt;/a&gt; and
if you chose to use assembly passing in the &lt;a href="http://msdn.microsoft.com/en-us/library/system.reflection.assemblyname.aspx"&gt;AssemblyName&lt;/a&gt;,
for instance if the assembly in in the GAC, then it will be loaded using &lt;a href="http://msdn.microsoft.com/en-us/library/system.reflection.assembly.load.aspx"&gt;Assembly.Load&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
I chose to use path, because I just placed the file inside of the MSBuild Extensions
directory (&lt;strong&gt;%Program Files (x86)%MSBuild&lt;/strong&gt;) in a folder named Custom.
Then I created my config transform file to be the following.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;?xml version="1.0"?&amp;gt;

&amp;lt;configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"&amp;gt;
                        
  &amp;lt;xdt:Import path="C:\Program Files (x86)\MSBuild\Custom\CustomTransformType.dll"
              namespace="CustomTransformType" /&amp;gt;

  &amp;lt;appSettings&amp;gt;
    &amp;lt;add key="one" value="one-replaced" xdt:Transform="Replace" xdt:Locator="Match(key)" /&amp;gt;
    &amp;lt;add key="two" value="two-replaced" xdt:Transform="AttributeRegexReplace(Attribute='value', Pattern='here',Replacement='REPLACED')" xdt:Locator="Match(key)"/&amp;gt;
  &amp;lt;/appSettings&amp;gt;
&amp;lt;/configuration&amp;gt;&lt;/pre&gt;
&lt;p&gt;
Then to run this I created an MSBuild file, PerformTransform.proj, which is shown
below.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;Project ToolsVersion="4.0" DefaultTargets="Demo" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&amp;gt;
  &amp;lt;UsingTask TaskName="TransformXml"
           AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll"/&amp;gt;

  &amp;lt;PropertyGroup&amp;gt;
    &amp;lt;TransformDest&amp;gt;web.tranzed.config&amp;lt;/TransformDest&amp;gt;
  &amp;lt;/PropertyGroup&amp;gt;
  
  &amp;lt;Target Name="Demo"&amp;gt;
    &amp;lt;Delete Files="$(TransformDest)" /&amp;gt;
    &amp;lt;TransformXml Source="web.config"
                  Transform="web.dev.config"
                  Destination="$(TransformDest)" /&amp;gt;                  
  &amp;lt;/Target&amp;gt;
  
&amp;lt;/Project&amp;gt;&lt;/pre&gt;
&lt;p&gt;
This file uses the TransformXml task as I outlined in a previous post &lt;a href="http://sedodream.com/2010/04/26/ConfigTransformationsOutsideOfWebAppBuilds.aspx"&gt;Config
transformations outside of web app builds&lt;/a&gt;. Once you execute the Demo target with
the command msbuild PerformTransform.proj /t:Demo you will see the file web.tranzed.config
with the following contents.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;?xml version="1.0"?&amp;gt;
&amp;lt;configuration&amp;gt;
  &amp;lt;appSettings&amp;gt;
    &amp;lt;add key="one" value="one-replaced"/&amp;gt;
    &amp;lt;add key="two" value="partial-replace-REPLACED-end"/&amp;gt;
    &amp;lt;add key="three" value="three here"/&amp;gt;
  &amp;lt;/appSettings&amp;gt;
&amp;lt;/configuration&amp;gt;&lt;/pre&gt;
&lt;p&gt;
So you can see that the replacement did occur as we intended. Below you will find
the download link for the samples as well as another blog entry for more info on the
out of the box transformations.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Resources&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Source download at: &lt;a title="http://sedotech.com/Content/samples/CustomTransformType.zip" href="http://sedotech.com/Content/samples/CustomTransformType.zip"&gt;http://sedotech.com/Content/samples/CustomTransformType.zip&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
More info on out of box transforms at: &lt;a title="http://vishaljoshi.blogspot.com/2009/03/web-deployment-webconfig-transformation_23.html" href="http://vishaljoshi.blogspot.com/2009/03/web-deployment-webconfig-transformation_23.html"&gt;http://vishaljoshi.blogspot.com/2009/03/web-deployment-webconfig-transformation_23.html&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,27dcfa0d-f88c-4dc3-ace1-0e0d7ef75c1f.aspx</comments>
      <category>Config-Transformation</category>
      <category>MSBuild</category>
      <category>MSDeploy</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=c926b957-b578-4d98-bbce-2260945de5cf</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,c926b957-b578-4d98-bbce-2260945de5cf.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,c926b957-b578-4d98-bbce-2260945de5cf.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=c926b957-b578-4d98-bbce-2260945de5cf</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
A while back I posted an entry on <a href="http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageIncludingExtraFilesOrExcludingSpecificFiles.aspx">How
to build a package including extra files or exclude files</a> a reader posted a question
to <a href="http://stackoverflow.com">StackOverflow.com</a> asking how to exclude
files from the created package based on the configuration for the project. He asked
me to take a look at it so I figured it would be a good blog post.
</p>
        <p>
From the previous <a href="http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageIncludingExtraFilesOrExcludingSpecificFiles.aspx">post</a> we
can see that the way to exclude files from packaging is by declaring an item as follows.
</p>
        <pre class="brush: xml;">&lt;ItemGroup&gt;
  &lt;ExcludeFromPackageFiles Include="Sample.Debug.xml"&gt;
    &lt;FromTarget&gt;Project&lt;/FromTarget&gt;
  &lt;/ExcludeFromPackageFiles&gt;
&lt;/ItemGroup&gt;</pre>
        <p>
So we need to extend this to only exclude files if the config is a certain value.
Since MSBuild supports <a href="http://msdn.microsoft.com/en-us/library/7szfhaft.aspx">conditions
on almost every element</a> this is going to be a breeze. As an example I have created
a sample web project with a scripts directory that has the following files.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/WindowsLiveWriter/WebDeploymentToolMSDeployHowtoexcludefil_A290/image_4.png">
            <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/WindowsLiveWriter/WebDeploymentToolMSDeployHowtoexcludefil_A290/image_thumb_1.png" width="244" height="214" />
          </a>
        </p>
        <p>
In that folder there I there are two files which have ‘debug’ in the name of the file.
We only want those to be included if the configuration is set to <strong>Debug</strong>,
or another way of putting it is we want to exclude those files if the configuration
is not Debug. So we need to create to add files to the <strong>ExcludeFromPackageFiles</strong> and
guard it with the condition that the configuration is not debug. Here is that.
</p>
        <pre class="brush: xml;">&lt;Target Name="CustomExlucdeFiles" BeforeTargets="ExcludeFilesFromPackage"&gt;
  &lt;ItemGroup Condition=" '$(Configuration)'!='Debug' "&gt;
    &lt;ExcludeFromPackageFiles Include="scripts\**\*debug*" /&gt;
  &lt;/ItemGroup&gt;
  
  &lt;Message Text="Configuration: $(Configuration)" /&gt;
  &lt;Message Text="ExcludeFromPackageFiles: @(ExcludeFromPackageFiles)" Importance="high" /&gt;
&lt;/Target&gt;</pre>
        <p>
You can see the item group defined above which does what we want. Please note that
I put this inside of a target, CustomExcludeFiles, I will discuss why in a bit but
let’s stay on topic now. So this is pretty straight forward when the item group is
evaluated all files under <em>scripts</em> which have <em>debug</em> in the file name
will be excluded if the configuration is not set to <em>Debug</em>. Let’s see if it
works, I will build the deployment package once in both debug &amp; release then examine
the contents of the Package folder.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/WindowsLiveWriter/WebDeploymentToolMSDeployHowtoexcludefil_A290/image_6.png">
            <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/WindowsLiveWriter/WebDeploymentToolMSDeployHowtoexcludefil_A290/image_thumb_2.png" width="709" height="465" />
          </a>
        </p>
        <p>
So we can see that the files were excluded from the Release package. Now back to why
I declared the item group in a target instead of directly in the project file itself.
I noticed that if I declare that item in the project file there are some visual issues
with the representation in the Solution Explorer. To be specific the files show up
as dups, see image below.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/WindowsLiveWriter/WebDeploymentToolMSDeployHowtoexcludefil_A290/image_8.png">
            <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/WindowsLiveWriter/WebDeploymentToolMSDeployHowtoexcludefil_A290/image_thumb_3.png" width="244" height="233" />
          </a>
        </p>
        <p>
I have reported this to the right people, but for now this is a harmless issue with
an easy workaround.
</p>
        <p>
Sayed Ibrahim Hashimi
</p>
      </body>
      <title>Web Deployment Tool (MSDeploy): How to exclude files from package based on Configuration</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,c926b957-b578-4d98-bbce-2260945de5cf.aspx</guid>
      <link>http://sedodream.com/2010/08/15/WebDeploymentToolMSDeployHowToExcludeFilesFromPackageBasedOnConfiguration.aspx</link>
      <pubDate>Sun, 15 Aug 2010 18:56:50 GMT</pubDate>
      <description>&lt;p&gt;
A while back I posted an entry on &lt;a href="http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageIncludingExtraFilesOrExcludingSpecificFiles.aspx"&gt;How
to build a package including extra files or exclude files&lt;/a&gt; a reader posted a question
to &lt;a href="http://stackoverflow.com"&gt;StackOverflow.com&lt;/a&gt; asking how to exclude
files from the created package based on the configuration for the project. He asked
me to take a look at it so I figured it would be a good blog post.
&lt;/p&gt;
&lt;p&gt;
From the previous &lt;a href="http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageIncludingExtraFilesOrExcludingSpecificFiles.aspx"&gt;post&lt;/a&gt; we
can see that the way to exclude files from packaging is by declaring an item as follows.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;ItemGroup&amp;gt;
  &amp;lt;ExcludeFromPackageFiles Include=&amp;quot;Sample.Debug.xml&amp;quot;&amp;gt;
    &amp;lt;FromTarget&amp;gt;Project&amp;lt;/FromTarget&amp;gt;
  &amp;lt;/ExcludeFromPackageFiles&amp;gt;
&amp;lt;/ItemGroup&amp;gt;&lt;/pre&gt;
&lt;p&gt;
So we need to extend this to only exclude files if the config is a certain value.
Since MSBuild supports &lt;a href="http://msdn.microsoft.com/en-us/library/7szfhaft.aspx"&gt;conditions
on almost every element&lt;/a&gt; this is going to be a breeze. As an example I have created
a sample web project with a scripts directory that has the following files.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/WindowsLiveWriter/WebDeploymentToolMSDeployHowtoexcludefil_A290/image_4.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/WindowsLiveWriter/WebDeploymentToolMSDeployHowtoexcludefil_A290/image_thumb_1.png" width="244" height="214" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
In that folder there I there are two files which have ‘debug’ in the name of the file.
We only want those to be included if the configuration is set to &lt;strong&gt;Debug&lt;/strong&gt;,
or another way of putting it is we want to exclude those files if the configuration
is not Debug. So we need to create to add files to the &lt;strong&gt;ExcludeFromPackageFiles&lt;/strong&gt; and
guard it with the condition that the configuration is not debug. Here is that.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;Target Name=&amp;quot;CustomExlucdeFiles&amp;quot; BeforeTargets=&amp;quot;ExcludeFilesFromPackage&amp;quot;&amp;gt;
  &amp;lt;ItemGroup Condition=&amp;quot; '$(Configuration)'!='Debug' &amp;quot;&amp;gt;
    &amp;lt;ExcludeFromPackageFiles Include=&amp;quot;scripts\**\*debug*&amp;quot; /&amp;gt;
  &amp;lt;/ItemGroup&amp;gt;
  
  &amp;lt;Message Text=&amp;quot;Configuration: $(Configuration)&amp;quot; /&amp;gt;
  &amp;lt;Message Text=&amp;quot;ExcludeFromPackageFiles: @(ExcludeFromPackageFiles)&amp;quot; Importance=&amp;quot;high&amp;quot; /&amp;gt;
&amp;lt;/Target&amp;gt;&lt;/pre&gt;
&lt;p&gt;
You can see the item group defined above which does what we want. Please note that
I put this inside of a target, CustomExcludeFiles, I will discuss why in a bit but
let’s stay on topic now. So this is pretty straight forward when the item group is
evaluated all files under &lt;em&gt;scripts&lt;/em&gt; which have &lt;em&gt;debug&lt;/em&gt; in the file name
will be excluded if the configuration is not set to &lt;em&gt;Debug&lt;/em&gt;. Let’s see if it
works, I will build the deployment package once in both debug &amp;amp; release then examine
the contents of the Package folder.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/WindowsLiveWriter/WebDeploymentToolMSDeployHowtoexcludefil_A290/image_6.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/WindowsLiveWriter/WebDeploymentToolMSDeployHowtoexcludefil_A290/image_thumb_2.png" width="709" height="465" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
So we can see that the files were excluded from the Release package. Now back to why
I declared the item group in a target instead of directly in the project file itself.
I noticed that if I declare that item in the project file there are some visual issues
with the representation in the Solution Explorer. To be specific the files show up
as dups, see image below.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/WindowsLiveWriter/WebDeploymentToolMSDeployHowtoexcludefil_A290/image_8.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/WindowsLiveWriter/WebDeploymentToolMSDeployHowtoexcludefil_A290/image_thumb_3.png" width="244" height="233" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
I have reported this to the right people, but for now this is a harmless issue with
an easy workaround.
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,c926b957-b578-4d98-bbce-2260945de5cf.aspx</comments>
      <category>Deployment</category>
      <category>MSBuild</category>
      <category>MSDeploy</category>
      <category>Web Deployment Tool</category>
      <category>Web Publishing Pipeline</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=610e67fd-a3e6-41cd-bab4-1e462ae76e8b</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,610e67fd-a3e6-41cd-bab4-1e462ae76e8b.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,610e67fd-a3e6-41cd-bab4-1e462ae76e8b.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=610e67fd-a3e6-41cd-bab4-1e462ae76e8b</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you are doing any kind of web development and you are not familiar with the <a href="http://www.microsoft.com/web/downloads/platform.aspx">Web
Platform Installer</a>(WPI) then you need to take a look at it. I just installed <a href="http://wordpress.org/">WordPress</a> on
IIS 7 with just a few clicks and  filled in a few text boxes. When you install <a href="http://wordpress.org/">WordPress</a> there
are some prerequisites like <a href="http://www.mysql.com/">mySql</a> and <a href="http://www.php.net/">php</a>.
The WPI was smart enough to realize that I had neither installed, downloaded those,
installed them and configured them. I was prompted for some info for those tools of
course. I’ve also installed a few other apps using the WPI like, <a href="http://www.iis.net/download/WebDeploy">MSDeploy</a> and <a href="http://www.dasblog.info/">dasBlog</a> and
I didn’t have any issues what so ever.
</p>
        <p>
When using the WPI there are two main categories that can be installed, <em>Web Platform</em> and <em>Web
Applications</em>. The Web Platform category includes items like frameworks (i.e.
ASP.NET, PHP), Database (i.e. mySql) and other high level shared components. The Web
Applications includes various web applications. Some others that I didn’t list previously
include; <a href="http://www.dotnetnuke.com/">DotNetNuke</a>, <a href="http://www.nopcommerce.com/">nopCommerce</a>,
and <a href="http://umbraco.org/">umbarco</a> just to name a few. I’m not sure how
many apps are available but it looks like at least 50.
</p>
        <p>
If you are an app creator and would like to share your app then you can visit the <a href="http://www.microsoft.com/web/gallery/developer.aspx">WPI
Developer</a> page for a starting point.
</p>
      </body>
      <title>Installing web apps made easy: Web Platform Installer</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,610e67fd-a3e6-41cd-bab4-1e462ae76e8b.aspx</guid>
      <link>http://sedodream.com/2010/06/07/InstallingWebAppsMadeEasyWebPlatformInstaller.aspx</link>
      <pubDate>Mon, 07 Jun 2010 03:17:01 GMT</pubDate>
      <description>&lt;p&gt;
If you are doing any kind of web development and you are not familiar with the &lt;a href="http://www.microsoft.com/web/downloads/platform.aspx"&gt;Web
Platform Installer&lt;/a&gt;(WPI) then you need to take a look at it. I just installed &lt;a href="http://wordpress.org/"&gt;WordPress&lt;/a&gt; on
IIS 7 with just a few clicks and&amp;#160; filled in a few text boxes. When you install &lt;a href="http://wordpress.org/"&gt;WordPress&lt;/a&gt; there
are some prerequisites like &lt;a href="http://www.mysql.com/"&gt;mySql&lt;/a&gt; and &lt;a href="http://www.php.net/"&gt;php&lt;/a&gt;.
The WPI was smart enough to realize that I had neither installed, downloaded those,
installed them and configured them. I was prompted for some info for those tools of
course. I’ve also installed a few other apps using the WPI like, &lt;a href="http://www.iis.net/download/WebDeploy"&gt;MSDeploy&lt;/a&gt; and &lt;a href="http://www.dasblog.info/"&gt;dasBlog&lt;/a&gt; and
I didn’t have any issues what so ever.
&lt;/p&gt;
&lt;p&gt;
When using the WPI there are two main categories that can be installed, &lt;em&gt;Web Platform&lt;/em&gt; and &lt;em&gt;Web
Applications&lt;/em&gt;. The Web Platform category includes items like frameworks (i.e.
ASP.NET, PHP), Database (i.e. mySql) and other high level shared components. The Web
Applications includes various web applications. Some others that I didn’t list previously
include; &lt;a href="http://www.dotnetnuke.com/"&gt;DotNetNuke&lt;/a&gt;, &lt;a href="http://www.nopcommerce.com/"&gt;nopCommerce&lt;/a&gt;,
and &lt;a href="http://umbraco.org/"&gt;umbarco&lt;/a&gt; just to name a few. I’m not sure how
many apps are available but it looks like at least 50.
&lt;/p&gt;
&lt;p&gt;
If you are an app creator and would like to share your app then you can visit the &lt;a href="http://www.microsoft.com/web/gallery/developer.aspx"&gt;WPI
Developer&lt;/a&gt; page for a starting point.
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,610e67fd-a3e6-41cd-bab4-1e462ae76e8b.aspx</comments>
      <category>Deployment</category>
      <category>IIS</category>
      <category>MSDeploy</category>
      <category>web</category>
      <category>Web Platform Installer</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=803d77d7-a220-4cee-a803-f6291cd4ba71</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,803d77d7-a220-4cee-a803-f6291cd4ba71.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,803d77d7-a220-4cee-a803-f6291cd4ba71.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=803d77d7-a220-4cee-a803-f6291cd4ba71</wfw:commentRss>
      <slash:comments>6</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you are using Visual Studio 2010 then you may already be aware that <a href="http://www.iis.net/download/WebDeploy">Web
Deployment Tool</a> (aka MSDeploy) is integrated into Visual Studio. I’ve posted a
few blog entries already about this tool. Two of the common questions that I get discussing
this with people are
</p>
        <ol>
          <li>
How do I exclude files from being placed in the package? 
</li>
          <li>
How do I add other files to the created package? 
</li>
        </ol>
        <p>
I will address these two questions here, first we look at the easier one, how to exclude
files but we will go over a bit of background first.
</p>
        <h3>Web Publishing Pipeline
</h3>
        <p>
With Visual Studio 2010 a new concept has been created which is known as the Web Publishing
Pipeline. In a nutshell this is a process which will take your web application, build
it and eventually create a package that you can use to deploy your application. This
process is fully captured in MSBuild. With VS 2010 many targets and many tasks are
shipped to support this process. Since its captured in MSBuild format, you can customize
and extend to your hearts desire. So what we need to do is hook into this process
to perform the customizations that we need. This process is captured in the following
files.
</p>
        <pre class="brush: plain;">%program files%\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets
%program files%\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets</pre>
        <p>
        </p>
        <p>
The Microsoft.WebApplication.targets file is imported by the web applications projects
file, then that file imports the Microsoft.Web.Publishing.targets file.
</p>
        <h3>Excluding files from being packaged
</h3>
        <p>
If you open the project file of a web application created with VS 2010 towards the
bottom of it you will find a line with.
</p>
        <pre class="brush: xml;">&lt;Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" /&gt;</pre>
        <p>
BTW you can open the project file inside of VS. Right click on the project pick <em>Unload
Project</em>. Then right click on the unloaded project and select <em>Edit Project</em>.
</p>
        <p>
This statement will include all the targets and tasks that we need. Most of our customizations
should be <strong>after</strong> that import, if you are not sure put if after! So
if you have files to exclude there is an item name, <strong>ExcludeFromPackageFiles</strong>,
that can be used to do so. For example let’s say that you have file named Sample.Debug.js
which included in your web application but you want that file to be excluded from
the created packages. You can place the snippet below after that import statement.
</p>
        <pre class="brush: xml;">&lt;ItemGroup&gt;
  &lt;ExcludeFromPackageFiles Include="Sample.Debug.xml"&gt;
    &lt;FromTarget&gt;Project&lt;/FromTarget&gt;
  &lt;/ExcludeFromPackageFiles&gt;
&lt;/ItemGroup&gt;</pre>
        <p>
By declaring populating this item the files will automatically be excluded. Note the
usage of the FromTarget metadata here. I will not get into that here, but you should
know to always specify that.
</p>
        <h3>Including extra files into the package
</h3>
        <p>
Including extra files into the package is a bit harder but still no bigee if you are
comfortable with MSBuild, and if you are not then <a href="http://www.amazon.com/gp/product/0735626286?ie=UTF8&amp;tag=sedodream-20&amp;linkCode=xm2&amp;camp=1789&amp;creativeASIN=0735626286">read
this</a>.  In order to do this we need to hook into the part of the process that
collects the files for packaging. The target we need to extend is called <strong>CopyAllFilesToSingleFolder</strong>.
This target has a dependency property, <em>PipelinePreDeployCopyAllFilesToOneFolderDependsOn</em>,
that we can tap into and inject our own target. So we will create a target named <em>CustomCollectFiles</em> and
inject that into the process. We achieve this with the following (<strong>remember
after the import statement</strong>).
</p>
        <pre class="brush: xml;">&lt;PropertyGroup&gt;
  &lt;CopyAllFilesToSingleFolderForPackageDependsOn&gt;
    CustomCollectFiles;
    $(CopyAllFilesToSingleFolderForPackageDependsOn);
  &lt;/CopyAllFilesToSingleFolderForPackageDependsOn&gt;
&lt;/PropertyGroup&gt;</pre>
        <p>
This will add our target to the process, now we need to define the target itself.
Let’s assume that you have a folder named Extra Files that sits 1 level above your
web project. You want to include all of those files. Here is the <em>CustomCollectFiles</em> target
and we discuss after that.
</p>
        <pre class="brush: xml;">&lt;Target Name="CustomCollectFiles"&gt;
  &lt;ItemGroup&gt;
    &lt;_CustomFiles Include="..\Extra Files\**\*" /&gt;

    &lt;FilesForPackagingFromProject  Include="%(_CustomFiles.Identity)"&gt;
      &lt;DestinationRelativePath&gt;Extra Files\%(RecursiveDir)%(Filename)%(Extension)&lt;/DestinationRelativePath&gt;
    &lt;/FilesForPackagingFromProject&gt;
  &lt;/ItemGroup&gt;
&lt;/Target&gt;</pre>
        <p>
Here what I did was create the item <em>_CustomFiles</em> and in the Include attribute
told it to pick up all the files in that folder and any folder underneath it. Then
I use this item to populate the FilesForPackagingFromProject item. This is the item
that MSDeploy actually uses to add extra files. Also notice that I declared the metadata <em>DestinationRelativePath</em> value.
This will determine the relative path that it will be placed in the package. I used
the statement <em>Extra Files%(RecursiveDir)%(Filename)%(Extension)</em> here. What
that is saying is to place it in the same relative location in the package as it is
under the Extra Files folder.
</p>
        <p>
Admittedly this could be easier, but its not too bad, and its pretty flexible.
</p>
        <p>
Sayed Ibrahim Hashimi
</p>
      </body>
      <title>Web Deployment Tool (MSDeploy) : Build Package including extra files or excluding specific files</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,803d77d7-a220-4cee-a803-f6291cd4ba71.aspx</guid>
      <link>http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageIncludingExtraFilesOrExcludingSpecificFiles.aspx</link>
      <pubDate>Sat, 01 May 2010 03:09:16 GMT</pubDate>
      <description>&lt;p&gt;
If you are using Visual Studio 2010 then you may already be aware that &lt;a href="http://www.iis.net/download/WebDeploy"&gt;Web
Deployment Tool&lt;/a&gt; (aka MSDeploy) is integrated into Visual Studio. I’ve posted a
few blog entries already about this tool. Two of the common questions that I get discussing
this with people are
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
How do I exclude files from being placed in the package? 
&lt;/li&gt;
&lt;li&gt;
How do I add other files to the created package? 
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
I will address these two questions here, first we look at the easier one, how to exclude
files but we will go over a bit of background first.
&lt;/p&gt;
&lt;h3&gt;Web Publishing Pipeline
&lt;/h3&gt;
&lt;p&gt;
With Visual Studio 2010 a new concept has been created which is known as the Web Publishing
Pipeline. In a nutshell this is a process which will take your web application, build
it and eventually create a package that you can use to deploy your application. This
process is fully captured in MSBuild. With VS 2010 many targets and many tasks are
shipped to support this process. Since its captured in MSBuild format, you can customize
and extend to your hearts desire. So what we need to do is hook into this process
to perform the customizations that we need. This process is captured in the following
files.
&lt;/p&gt;
&lt;pre class="brush: plain;"&gt;%program files%\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets
%program files%\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets&lt;/pre&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
The Microsoft.WebApplication.targets file is imported by the web applications projects
file, then that file imports the Microsoft.Web.Publishing.targets file.
&lt;/p&gt;
&lt;h3&gt;Excluding files from being packaged
&lt;/h3&gt;
&lt;p&gt;
If you open the project file of a web application created with VS 2010 towards the
bottom of it you will find a line with.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;Import Project=&amp;quot;$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets&amp;quot; /&amp;gt;&lt;/pre&gt;
&lt;p&gt;
BTW you can open the project file inside of VS. Right click on the project pick &lt;em&gt;Unload
Project&lt;/em&gt;. Then right click on the unloaded project and select &lt;em&gt;Edit Project&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
This statement will include all the targets and tasks that we need. Most of our customizations
should be &lt;strong&gt;after&lt;/strong&gt; that import, if you are not sure put if after! So
if you have files to exclude there is an item name, &lt;strong&gt;ExcludeFromPackageFiles&lt;/strong&gt;,
that can be used to do so. For example let’s say that you have file named Sample.Debug.js
which included in your web application but you want that file to be excluded from
the created packages. You can place the snippet below after that import statement.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;ItemGroup&amp;gt;
  &amp;lt;ExcludeFromPackageFiles Include=&amp;quot;Sample.Debug.xml&amp;quot;&amp;gt;
    &amp;lt;FromTarget&amp;gt;Project&amp;lt;/FromTarget&amp;gt;
  &amp;lt;/ExcludeFromPackageFiles&amp;gt;
&amp;lt;/ItemGroup&amp;gt;&lt;/pre&gt;
&lt;p&gt;
By declaring populating this item the files will automatically be excluded. Note the
usage of the FromTarget metadata here. I will not get into that here, but you should
know to always specify that.
&lt;/p&gt;
&lt;h3&gt;Including extra files into the package
&lt;/h3&gt;
&lt;p&gt;
Including extra files into the package is a bit harder but still no bigee if you are
comfortable with MSBuild, and if you are not then &lt;a href="http://www.amazon.com/gp/product/0735626286?ie=UTF8&amp;amp;tag=sedodream-20&amp;amp;linkCode=xm2&amp;amp;camp=1789&amp;amp;creativeASIN=0735626286"&gt;read
this&lt;/a&gt;.&amp;#160; In order to do this we need to hook into the part of the process that
collects the files for packaging. The target we need to extend is called &lt;strong&gt;CopyAllFilesToSingleFolder&lt;/strong&gt;.
This target has a dependency property, &lt;em&gt;PipelinePreDeployCopyAllFilesToOneFolderDependsOn&lt;/em&gt;,
that we can tap into and inject our own target. So we will create a target named &lt;em&gt;CustomCollectFiles&lt;/em&gt; and
inject that into the process. We achieve this with the following (&lt;strong&gt;remember
after the import statement&lt;/strong&gt;).
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;PropertyGroup&amp;gt;
  &amp;lt;CopyAllFilesToSingleFolderForPackageDependsOn&amp;gt;
    CustomCollectFiles;
    $(CopyAllFilesToSingleFolderForPackageDependsOn);
  &amp;lt;/CopyAllFilesToSingleFolderForPackageDependsOn&amp;gt;
&amp;lt;/PropertyGroup&amp;gt;&lt;/pre&gt;
&lt;p&gt;
This will add our target to the process, now we need to define the target itself.
Let’s assume that you have a folder named Extra Files that sits 1 level above your
web project. You want to include all of those files. Here is the &lt;em&gt;CustomCollectFiles&lt;/em&gt; target
and we discuss after that.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;Target Name=&amp;quot;CustomCollectFiles&amp;quot;&amp;gt;
  &amp;lt;ItemGroup&amp;gt;
    &amp;lt;_CustomFiles Include=&amp;quot;..\Extra Files\**\*&amp;quot; /&amp;gt;

    &amp;lt;FilesForPackagingFromProject  Include=&amp;quot;%(_CustomFiles.Identity)&amp;quot;&amp;gt;
      &amp;lt;DestinationRelativePath&amp;gt;Extra Files\%(RecursiveDir)%(Filename)%(Extension)&amp;lt;/DestinationRelativePath&amp;gt;
    &amp;lt;/FilesForPackagingFromProject&amp;gt;
  &amp;lt;/ItemGroup&amp;gt;
&amp;lt;/Target&amp;gt;&lt;/pre&gt;
&lt;p&gt;
Here what I did was create the item &lt;em&gt;_CustomFiles&lt;/em&gt; and in the Include attribute
told it to pick up all the files in that folder and any folder underneath it. Then
I use this item to populate the FilesForPackagingFromProject item. This is the item
that MSDeploy actually uses to add extra files. Also notice that I declared the metadata &lt;em&gt;DestinationRelativePath&lt;/em&gt; value.
This will determine the relative path that it will be placed in the package. I used
the statement &lt;em&gt;Extra Files%(RecursiveDir)%(Filename)%(Extension)&lt;/em&gt; here. What
that is saying is to place it in the same relative location in the package as it is
under the Extra Files folder.
&lt;/p&gt;
&lt;p&gt;
Admittedly this could be easier, but its not too bad, and its pretty flexible.
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,803d77d7-a220-4cee-a803-f6291cd4ba71.aspx</comments>
      <category>MSBuild</category>
      <category>MSBuild 4.0</category>
      <category>MSDeploy</category>
      <category>Visual Studio</category>
      <category>Visual Studio 2010</category>
      <category>Web Deployment Tool</category>
      <category>Web Publishing Pipeline</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=ff6dfe05-99e8-421b-aedd-d57babdeed66</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,ff6dfe05-99e8-421b-aedd-d57babdeed66.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,ff6dfe05-99e8-421b-aedd-d57babdeed66.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=ff6dfe05-99e8-421b-aedd-d57babdeed66</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you are using Visual Studio 2010 then you may already be familiar with the <a href="http://msdn.microsoft.com/en-us/library/dd465326.aspx">Web.config
transformations</a> that are now available. What you might not know is that you can
use that same technology to transform config files outside of the build process. You
will need Visual Studio 2010 installed on the machine where you perform these transformations.
It is very easy to perform these transformation as well. Let’s say that we start with
the app.config file shown below.
</p>
        <pre class="brush: xml;">&lt;configuration&gt;
    &lt;connectionStrings&gt;
        &lt;clear/&gt;
        &lt;add name="Default" connectionString="Data Source=localhost;Initial Catalog=Sample01;Integrated Security=True;" /&gt;
    &lt;/connectionStrings&gt;
    
    &lt;appSettings&gt;
        &lt;add key="contactEmail" value="contact@demo.example.com"/&gt;
        &lt;add key="siteUrl" value="http://demo.example.com"/&gt;
    &lt;/appSettings&gt;
    
&lt;/configuration&gt;</pre>
        <p>
Then we create another file, transform.xml, which contains our transformations. That
file is shown below.
</p>
        <pre class="brush: xml;">&lt;configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"&gt;
    &lt;connectionStrings&gt;
        &lt;clear/&gt;
        &lt;add name="Default" connectionString="Data Source=NOT-localhost;Initial Catalog=Sample01;Integrated Security=True;" 
             xdt:Locator="Match(name)" xdt:Transform="Replace"/&gt;
    &lt;/connectionStrings&gt;

    &lt;appSettings&gt;
        &lt;add key="contactEmail" value="contact@example.com" xdt:Locator="Match(key)" xdt:Transform="Replace"/&gt;
        &lt;add key="siteUrl" value="http://example.com" xdt:Locator="Match(key)" xdt:Transform="Replace"/&gt;
    &lt;/appSettings&gt;

&lt;/configuration&gt;</pre>
        <p>
Then we can easily execute the transformations by using MSBuild. So I created a file
named trans.proj and it is shown below.
</p>
        <pre class="brush: xml;">&lt;Project ToolsVersion="4.0" DefaultTargets="Demo" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
    &lt;UsingTask TaskName="TransformXml"
             AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll"/&gt;

    &lt;Target Name="Demo"&gt;
        &lt;TransformXml Source="app.config"
                      Transform="Transform.xml"
                      Destination="app.prod.config"/&gt;
    &lt;/Target&gt;
&lt;/Project&gt;</pre>
        <p>
This MSBuild file uses the TransformXml task which is shipped with Visual Studio 2010.
We specify the source file, transform file and the destination. Pretty straight forward.
</p>
        <p>
In order to execute this I open a Visual Studio 2010 command prompt, browse to the
directory containing both files, and enter the following command 
</p>
        <pre class="brush: plain;">msbuild trans.proj /t:Demo</pre>
        <p>
Once you do this then you will find the file app.prod.config with the following contents.
</p>
        <pre class="brush: xml;">&lt;configuration&gt;
    &lt;connectionStrings&gt;
        &lt;clear/&gt;
        &lt;add name="Default" connectionString="Data Source=NOT-localhost;Initial Catalog=Sample01;Integrated Security=True;"/&gt;
    &lt;/connectionStrings&gt;
    
    &lt;appSettings&gt;
        &lt;add key="contactEmail" value="contact@example.com"/&gt;
        &lt;add key="siteUrl" value="http://example.com"/&gt;
    &lt;/appSettings&gt;
    
&lt;/configuration&gt;</pre>
        <p>
Sayed Ibrahim Hashimi
</p>
      </body>
      <title>Config transformations outside of web app builds</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,ff6dfe05-99e8-421b-aedd-d57babdeed66.aspx</guid>
      <link>http://sedodream.com/2010/04/26/ConfigTransformationsOutsideOfWebAppBuilds.aspx</link>
      <pubDate>Mon, 26 Apr 2010 04:22:06 GMT</pubDate>
      <description>&lt;p&gt;
If you are using Visual Studio 2010 then you may already be familiar with the &lt;a href="http://msdn.microsoft.com/en-us/library/dd465326.aspx"&gt;Web.config
transformations&lt;/a&gt; that are now available. What you might not know is that you can
use that same technology to transform config files outside of the build process. You
will need Visual Studio 2010 installed on the machine where you perform these transformations.
It is very easy to perform these transformation as well. Let’s say that we start with
the app.config file shown below.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;configuration&amp;gt;
    &amp;lt;connectionStrings&amp;gt;
        &amp;lt;clear/&amp;gt;
        &amp;lt;add name=&amp;quot;Default&amp;quot; connectionString=&amp;quot;Data Source=localhost;Initial Catalog=Sample01;Integrated Security=True;&amp;quot; /&amp;gt;
    &amp;lt;/connectionStrings&amp;gt;
    
    &amp;lt;appSettings&amp;gt;
        &amp;lt;add key=&amp;quot;contactEmail&amp;quot; value=&amp;quot;contact@demo.example.com&amp;quot;/&amp;gt;
        &amp;lt;add key=&amp;quot;siteUrl&amp;quot; value=&amp;quot;http://demo.example.com&amp;quot;/&amp;gt;
    &amp;lt;/appSettings&amp;gt;
    
&amp;lt;/configuration&amp;gt;&lt;/pre&gt;
&lt;p&gt;
Then we create another file, transform.xml, which contains our transformations. That
file is shown below.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;configuration xmlns:xdt=&amp;quot;http://schemas.microsoft.com/XML-Document-Transform&amp;quot;&amp;gt;
    &amp;lt;connectionStrings&amp;gt;
        &amp;lt;clear/&amp;gt;
        &amp;lt;add name=&amp;quot;Default&amp;quot; connectionString=&amp;quot;Data Source=NOT-localhost;Initial Catalog=Sample01;Integrated Security=True;&amp;quot; 
             xdt:Locator=&amp;quot;Match(name)&amp;quot; xdt:Transform=&amp;quot;Replace&amp;quot;/&amp;gt;
    &amp;lt;/connectionStrings&amp;gt;

    &amp;lt;appSettings&amp;gt;
        &amp;lt;add key=&amp;quot;contactEmail&amp;quot; value=&amp;quot;contact@example.com&amp;quot; xdt:Locator=&amp;quot;Match(key)&amp;quot; xdt:Transform=&amp;quot;Replace&amp;quot;/&amp;gt;
        &amp;lt;add key=&amp;quot;siteUrl&amp;quot; value=&amp;quot;http://example.com&amp;quot; xdt:Locator=&amp;quot;Match(key)&amp;quot; xdt:Transform=&amp;quot;Replace&amp;quot;/&amp;gt;
    &amp;lt;/appSettings&amp;gt;

&amp;lt;/configuration&amp;gt;&lt;/pre&gt;
&lt;p&gt;
Then we can easily execute the transformations by using MSBuild. So I created a file
named trans.proj and it is shown below.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;Project ToolsVersion=&amp;quot;4.0&amp;quot; DefaultTargets=&amp;quot;Demo&amp;quot; xmlns=&amp;quot;http://schemas.microsoft.com/developer/msbuild/2003&amp;quot;&amp;gt;
    &amp;lt;UsingTask TaskName=&amp;quot;TransformXml&amp;quot;
             AssemblyFile=&amp;quot;$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll&amp;quot;/&amp;gt;

    &amp;lt;Target Name=&amp;quot;Demo&amp;quot;&amp;gt;
        &amp;lt;TransformXml Source=&amp;quot;app.config&amp;quot;
                      Transform=&amp;quot;Transform.xml&amp;quot;
                      Destination=&amp;quot;app.prod.config&amp;quot;/&amp;gt;
    &amp;lt;/Target&amp;gt;
&amp;lt;/Project&amp;gt;&lt;/pre&gt;
&lt;p&gt;
This MSBuild file uses the TransformXml task which is shipped with Visual Studio 2010.
We specify the source file, transform file and the destination. Pretty straight forward.
&lt;/p&gt;
&lt;p&gt;
In order to execute this I open a Visual Studio 2010 command prompt, browse to the
directory containing both files, and enter the following command 
&lt;/p&gt;
&lt;pre class="brush: plain;"&gt;msbuild trans.proj /t:Demo&lt;/pre&gt;
&lt;p&gt;
Once you do this then you will find the file app.prod.config with the following contents.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;configuration&amp;gt;
    &amp;lt;connectionStrings&amp;gt;
        &amp;lt;clear/&amp;gt;
        &amp;lt;add name=&amp;quot;Default&amp;quot; connectionString=&amp;quot;Data Source=NOT-localhost;Initial Catalog=Sample01;Integrated Security=True;&amp;quot;/&amp;gt;
    &amp;lt;/connectionStrings&amp;gt;
    
    &amp;lt;appSettings&amp;gt;
        &amp;lt;add key=&amp;quot;contactEmail&amp;quot; value=&amp;quot;contact@example.com&amp;quot;/&amp;gt;
        &amp;lt;add key=&amp;quot;siteUrl&amp;quot; value=&amp;quot;http://example.com&amp;quot;/&amp;gt;
    &amp;lt;/appSettings&amp;gt;
    
&amp;lt;/configuration&amp;gt;&lt;/pre&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,ff6dfe05-99e8-421b-aedd-d57babdeed66.aspx</comments>
      <category>Config-Transformation</category>
      <category>MSBuild</category>
      <category>MSBuild 4.0</category>
      <category>MSDeploy</category>
      <category>Visual Studio</category>
      <category>Visual Studio 2010</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=bd37422c-41b7-450d-ada5-122251483b53</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,bd37422c-41b7-450d-ada5-122251483b53.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,bd37422c-41b7-450d-ada5-122251483b53.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=bd37422c-41b7-450d-ada5-122251483b53</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <em>Disclaimer: Take what you read here with a grain of salt, I’m not an expert at
providers … yet :)</em>
        </p>
        <p>
I’ve known for quite a while that the <a href="http://www.iis.net/expand/webdeploy">Web
Deployment Tool</a> supports custom providers but I’ve never really looked at what
it took to get actually write one. Tonight I wanted to write a simple provider to
just sync a file from one place to another, just to see what is involved in creating
that provider. In this post I describe how I created the provider. First you have
to have the <a href="http://www.iis.net/expand/webdeploy">Web Deployment Tool</a> installed,
I’ve got the RTM version installed, but recently they delivered <a href="http://blogs.iis.net/msdeploy/archive/2010/02/04/web-deploy-1-1-has-shipped.aspx">version
1.1</a> either should work. First things first, you need to create a class library
project in Visual Studio. For this example I used Visual Studio 2010 RC for the reason
that it’s the only version of Visual Studio that I have installed on this machine.
If you are using Visual Studio 2010 make sure that you specify to build for .NET 3.5
because MSDeploy won’t pickup any providers written in .NET 4.0. To specify that your
project should build for .NET 3.5 go to Project-&gt;Properties then on the Application
tab pick the Target Framework to be .NET 3.5. See the image below for clarification.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/WindowsLiveWriter/WebDeploymentToolMSDeployCustomProviderT_328/targetframework-.net35_2.png">
            <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="targetframework-.net35" border="0" alt="targetframework-.net35" src="http://sedodream.com/content/binary/WindowsLiveWriter/WebDeploymentToolMSDeployCustomProviderT_328/targetframework-.net35_thumb.png" width="794" height="280" />
          </a>
        </p>
        <p>
You will need to reference the two assemblies Microsoft.Web.Deployment.dll and Microsoft.Web.Delegation.dll.
You can find both in the <strong><em>%Program Files%\IIS\Microsoft Web Deploy </em></strong>folder.
</p>
        <p>
After this you need to create the class which is the provider. I called my CustomFileProvider
because it will only sync a single file. The class should extend the <a href="http://msdn.microsoft.com/en-us/library/dd543130.aspx">DeploymentObjectProvider</a> class.
There are a couple abstract items that you must implement those are.
</p>
        <p>
          <strong>
            <u>CreateKeyAttributeData</u>
          </strong>
        </p>
        <p>
From what I can see this method is used to indicate how the “key attribute” is used.
For instance when you use a contentPath provider you would use a statement like <em>msdeploy
–verb:sync –source:contentPath=C:\one\pathToSync –dest:…</em> So we can see that the
value C:\one\pathToSync is passed to the provider without a name. This is the key
attribute value. This method for my provider looks like the following.
</p>
        <pre class="brush: csharp;">public override DeploymentObjectAttributeData CreateKeyAttributeData()
{
    DeploymentObjectAttributeData attributeData = new DeploymentObjectAttributeData(
        CustomFileProvider.KeyAttributeName,
        this.FilePath,
        DeploymentObjectAttributeKind.CaseInsensitiveCompare);

    return attributeData;
}</pre>
        <p>
In this case CustomFileProvider.KeyAttributeName is a const whose value is <em>path</em> and
its value is provided from the FilePath property. The other item that you have to
override is the Name property.
</p>
        <p>
          <strong>
            <u>Name</u>
          </strong>
        </p>
        <p>
This property returns the name of the provider. In all the samples that I have seen
(which is <a href="http://blogs.iis.net/kateroh/archive/2009/06/19/msdeploy-custom-provider-to-execute-batch-files.aspx">not</a><a href="http://blogs.iis.net/msdeploy/archive/2010/02/04/writing-extensible-providers-for-webdeploy-v1-rtm.aspx">very</a><a href="http://blogs.iis.net/msdeploy/archive/2009/03/30/msdeploy-sample-custom-provider-to-sync-mysql-databases-dbfullmysql.aspx">much</a>)
this name always agrees with the name of the <a href="http://msdn.microsoft.com/en-us/library/microsoft.web.deployment.deploymentproviderfactory.aspx">custom
provider factory</a>, more on that in a bit. So in their example I had mine return
the value customFile which my factory also returns.
</p>
        <p>
Outside of these two items there are some other methods that you need to know about
those are covered below.
</p>
        <p>
          <strong>
            <u>GetAttributes</u>
          </strong>
        </p>
        <p>
The <a href="http://msdn.microsoft.com/en-us/library/microsoft.web.deployment.deploymentobjectprovider.getattributes.aspx">GetAttributes</a> method
is kinda interesting. This method will be called on both the source and destination
and you need to understand which context its being called in and act accordingly.
You can determine if you are executing on the source or dest by using the <a href="http://msdn.microsoft.com/en-us/library/microsoft.web.deployment.deploymentobjectprovider.basecontext.aspx">BaseContext</a>.<a href="http://msdn.microsoft.com/en-us/library/microsoft.web.deployment.deploymentbasecontext.isdestinationobject.aspx">IsDestinationObject</a> property.
So for this provider if you are in the source you want to ensure that the file specified
exists, if not then raise a <a href="DeploymentFatalException">DeploymentFatalExcepton</a>,
this will stop the sync. If you are on the destination you could perform some checks
to see if the file is up-to-date or not. For a simple provider you can force a sync
to occur. You would do this by raising a <a href="http://msdn.microsoft.com/en-us/library/system.deployment.application.deploymentexception.aspx">DeploymentException</a>.
When you raise this exception at this time it causes the <a href="http://msdn.microsoft.com/en-us/library/microsoft.web.deployment.deploymentobjectprovider.add.aspx">Add</a> method
to be called, which is exactly what we want. Here is my version of the GetAttributes
method.
</p>
        <pre class="brush: csharp;">public override void GetAttributes(DeploymentAddAttributeContext addContext)
{
    if (this.BaseContext.IsDestinationObject)
    {
        // if we are on the destination and the file doesn't exist then we need to throw an exception
        // to ensure that the file gets synced. This happens because the Add command will be called for us.

        // Since I'm throwing an exception here Add will always be called, we could check to see if this file
        // was up-to-date and if so then skip this exception.
        throw new DeploymentException();
    }
    else
    {
        // We are acting on the source object here, make sure that the file exists on disk
        if (!File.Exists(this.FilePath))
        {
            string message = string.Format("File &lt;{0}&gt; does not exist",this.FilePath);
            throw new DeploymentFatalException(message);
        }
    }

    base.GetAttributes(addContext);
}</pre>
        <p>
For the most part the only thing left for this simple provider to implement is to
override the <a href="http://msdn.microsoft.com/en-us/library/microsoft.web.deployment.deploymentobjectprovider.add.aspx">Add</a> method.
First I will show the method then discuss its content. Here is the method.
</p>
        <pre class="brush: csharp;">public override void Add(DeploymentObject source, bool whatIf)
{
    // This is called on the Destination so this.FilePath is the dest path not source path
    if (!whatIf &amp;&amp; File.Exists(source.ProviderContext.Path))
    {
        // We can let MSDeploy do the actual sync for us using existig provider
        DeploymentProviderOptions sourceProviderOptions = new DeploymentProviderOptions(DeploymentWellKnownProvider.FilePath);
        sourceProviderOptions.Path = source.ProviderContext.Path;

        using (DeploymentObject sourceObject = DeploymentManager.CreateObject(sourceProviderOptions, new DeploymentBaseOptions()))
        {
            DeploymentProviderOptions destProviderOptions = new DeploymentProviderOptions(DeploymentWellKnownProvider.FilePath);
            destProviderOptions.Path = this.FilePath;

            // Make the call to perform an actual sync
            sourceObject.SyncTo(destProviderOptions, new DeploymentBaseOptions(), new DeploymentSyncOptions());
        }
    }
}</pre>
        <p>
First I check to make sure that we are not doing a whatif run (i.e. a run where we
don’t want to physically perform the action) and that the source file exists. Take
note of the fact that I’m explicitly using <strong>source.ProviderContext.Path</strong> to
get the source path. This provider has a property, FilePath, which contains the path
but it could be either source path or dest path depending on which end you are executing
in. the source.ProviderContent.Path will always point to the source value. After that
you can see that I’m actually leveraging an existing provider the <a href="http://technet.microsoft.com/en-us/library/ee207414%28WS.10%29.aspx">FilePath
provider</a> to do the actual sync for me. So all the dirty work is his job! If you
are writing a provider make sure to re-use any existing providers that you can, because
the code for this part looks like it can get nasty. I’ll leave that for another post.
</p>
        <p>
After I prepare the source options I create an instance of the <a href="http://msdn.microsoft.com/en-us/library/microsoft.web.deployment.deploymentobject.aspx">DeploymentObject</a> class,
prepare the FilePath provider and call <a href="http://msdn.microsoft.com/en-us/library/microsoft.web.deployment.deploymentobject.syncto.aspx">SyncTo</a> on
the object., this is where the physical sync occurs. That is basically it for the
provider itself now we need to create a provider factory class which is the guy who
knows how to create our providers for us.
</p>
        <p>
Fortunately creating custom provider factories is even easier then creating custom
providers themselves. I called mine CustomFileProviderFactory and the entire class
is shown below.
</p>
        <pre class="brush: csharp;">[DeploymentProviderFactory]
public class CustomFileProviderFactory : DeploymentProviderFactory
{
    protected override DeploymentObjectProvider Create(DeploymentProviderContext providerContext, DeploymentBaseContext baseContext)
    {
        return new CustomFileProvider(providerContext, baseContext);
    }

    public override string Description
    {
        get { return @"Custom provider to copy a file"; }
    }

    public override string ExamplePath
    {
        get { return @"c:\somefile.txt"; }
    }

    public override string FriendlyName
    {
        get { return "customFile"; }
    }
    public override string Name
    {
        get { return "customFile"; }
    }
}</pre>
        <p>
A few things to make note of; your class should extend the <a href="http://msdn.microsoft.com/en-us/library/microsoft.web.deployment.deploymentproviderfactory.aspx">DeploymentProviderFactory</a> class
and it should have the <a href="http://msdn.microsoft.com/en-us/library/microsoft.web.deployment.deploymentproviderfactoryattribute.aspx">DeploymentProviderFactory</a> attribute
attached to it. Besides that there are two properties FriendlyName and Name, once
again in all the samples I have seen they are always the same and always equal to
the Name property on the provider itself. I followed suit and copied them. I’m still
trying to figure out more about what each of these actually do, but for now I’m OK
with leaving them to be the same. So that is basically it.
</p>
        <p>
In order to have MSDeploy use the provider you have to create a folder named Extensibility
under the <strong><em>%Program Files%\IIS\Microsoft Web Deploy</em></strong> folder
if it doesn’t exist, and then copy the assembly into that folder. And then you are
good to go. Here is the snippet showing my custom provider in action!
</p>
        <pre class="brush: plain;">C:\temp\MSDeploy&gt;msdeploy -verb:sync -source:customFile=C:\temp\MSDeploy\Source\source.txt -dest:customFile=C:\temp
\MSDeploy\Dest\one.txt -verbose
Verbose: Performing synchronization pass #1.
Info: Adding MSDeploy.customFile (MSDeploy.customFile).
Info: Adding customFile (C:\temp\MSDeploy\Dest\one.txt).
Verbose: The dependency check 'DependencyCheckInUse' found no issues.
Verbose: The synchronization completed in 1 pass(es).
Total changes: 2 (2 added, 0 deleted, 0 updated, 0 parameters changed, 0 bytes copied)</pre>
        <p>
This was a pretty basic provider, but you have to start somewhere. I will post more
about custom providers as I find out more.
</p>
        <p>
          <font size="3">You can download the entire source at </font>
          <a title="http://sedotech.com/Resources#CustomProviders" href="http://sedotech.com/Resources#CustomProviders">
            <font size="3">http://sedotech.com/Resources#CustomProviders</font>
          </a>
          <font size="3"> under
the Custom Providers heading of the </font>
          <a href="http://sedotech.com/Resources#MSDeploy">
            <font size="3">MSDeploy</font>
          </a>
          <font size="3"> section.</font>
        </p>
        <p>
Sayed Ibrahim Hashimi
</p>
      </body>
      <title>Web Deployment Tool (MSDeploy) Custom Provider Take 1</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,bd37422c-41b7-450d-ada5-122251483b53.aspx</guid>
      <link>http://sedodream.com/2010/03/11/WebDeploymentToolMSDeployCustomProviderTake1.aspx</link>
      <pubDate>Thu, 11 Mar 2010 06:04:47 GMT</pubDate>
      <description>&lt;p&gt;
&lt;em&gt;Disclaimer: Take what you read here with a grain of salt, I’m not an expert at
providers … yet :)&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
I’ve known for quite a while that the &lt;a href="http://www.iis.net/expand/webdeploy"&gt;Web
Deployment Tool&lt;/a&gt; supports custom providers but I’ve never really looked at what
it took to get actually write one. Tonight I wanted to write a simple provider to
just sync a file from one place to another, just to see what is involved in creating
that provider. In this post I describe how I created the provider. First you have
to have the &lt;a href="http://www.iis.net/expand/webdeploy"&gt;Web Deployment Tool&lt;/a&gt; installed,
I’ve got the RTM version installed, but recently they delivered &lt;a href="http://blogs.iis.net/msdeploy/archive/2010/02/04/web-deploy-1-1-has-shipped.aspx"&gt;version
1.1&lt;/a&gt; either should work. First things first, you need to create a class library
project in Visual Studio. For this example I used Visual Studio 2010 RC for the reason
that it’s the only version of Visual Studio that I have installed on this machine.
If you are using Visual Studio 2010 make sure that you specify to build for .NET 3.5
because MSDeploy won’t pickup any providers written in .NET 4.0. To specify that your
project should build for .NET 3.5 go to Project-&amp;gt;Properties then on the Application
tab pick the Target Framework to be .NET 3.5. See the image below for clarification.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/WindowsLiveWriter/WebDeploymentToolMSDeployCustomProviderT_328/targetframework-.net35_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="targetframework-.net35" border="0" alt="targetframework-.net35" src="http://sedodream.com/content/binary/WindowsLiveWriter/WebDeploymentToolMSDeployCustomProviderT_328/targetframework-.net35_thumb.png" width="794" height="280" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
You will need to reference the two assemblies Microsoft.Web.Deployment.dll and Microsoft.Web.Delegation.dll.
You can find both in the &lt;strong&gt;&lt;em&gt;%Program Files%\IIS\Microsoft Web Deploy &lt;/em&gt;&lt;/strong&gt;folder.
&lt;/p&gt;
&lt;p&gt;
After this you need to create the class which is the provider. I called my CustomFileProvider
because it will only sync a single file. The class should extend the &lt;a href="http://msdn.microsoft.com/en-us/library/dd543130.aspx"&gt;DeploymentObjectProvider&lt;/a&gt; class.
There are a couple abstract items that you must implement those are.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;u&gt;CreateKeyAttributeData&lt;/u&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
From what I can see this method is used to indicate how the “key attribute” is used.
For instance when you use a contentPath provider you would use a statement like &lt;em&gt;msdeploy
–verb:sync –source:contentPath=C:\one\pathToSync –dest:…&lt;/em&gt; So we can see that the
value C:\one\pathToSync is passed to the provider without a name. This is the key
attribute value. This method for my provider looks like the following.
&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;public override DeploymentObjectAttributeData CreateKeyAttributeData()
{
    DeploymentObjectAttributeData attributeData = new DeploymentObjectAttributeData(
        CustomFileProvider.KeyAttributeName,
        this.FilePath,
        DeploymentObjectAttributeKind.CaseInsensitiveCompare);

    return attributeData;
}&lt;/pre&gt;
&lt;p&gt;
In this case CustomFileProvider.KeyAttributeName is a const whose value is &lt;em&gt;path&lt;/em&gt; and
its value is provided from the FilePath property. The other item that you have to
override is the Name property.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;u&gt;Name&lt;/u&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
This property returns the name of the provider. In all the samples that I have seen
(which is &lt;a href="http://blogs.iis.net/kateroh/archive/2009/06/19/msdeploy-custom-provider-to-execute-batch-files.aspx"&gt;not&lt;/a&gt; &lt;a href="http://blogs.iis.net/msdeploy/archive/2010/02/04/writing-extensible-providers-for-webdeploy-v1-rtm.aspx"&gt;very&lt;/a&gt; &lt;a href="http://blogs.iis.net/msdeploy/archive/2009/03/30/msdeploy-sample-custom-provider-to-sync-mysql-databases-dbfullmysql.aspx"&gt;much&lt;/a&gt;)
this name always agrees with the name of the &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.web.deployment.deploymentproviderfactory.aspx"&gt;custom
provider factory&lt;/a&gt;, more on that in a bit. So in their example I had mine return
the value customFile which my factory also returns.
&lt;/p&gt;
&lt;p&gt;
Outside of these two items there are some other methods that you need to know about
those are covered below.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;u&gt;GetAttributes&lt;/u&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
The &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.web.deployment.deploymentobjectprovider.getattributes.aspx"&gt;GetAttributes&lt;/a&gt; method
is kinda interesting. This method will be called on both the source and destination
and you need to understand which context its being called in and act accordingly.
You can determine if you are executing on the source or dest by using the &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.web.deployment.deploymentobjectprovider.basecontext.aspx"&gt;BaseContext&lt;/a&gt;.&lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.web.deployment.deploymentbasecontext.isdestinationobject.aspx"&gt;IsDestinationObject&lt;/a&gt; property.
So for this provider if you are in the source you want to ensure that the file specified
exists, if not then raise a &lt;a href="DeploymentFatalException"&gt;DeploymentFatalExcepton&lt;/a&gt;,
this will stop the sync. If you are on the destination you could perform some checks
to see if the file is up-to-date or not. For a simple provider you can force a sync
to occur. You would do this by raising a &lt;a href="http://msdn.microsoft.com/en-us/library/system.deployment.application.deploymentexception.aspx"&gt;DeploymentException&lt;/a&gt;.
When you raise this exception at this time it causes the &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.web.deployment.deploymentobjectprovider.add.aspx"&gt;Add&lt;/a&gt; method
to be called, which is exactly what we want. Here is my version of the GetAttributes
method.
&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;public override void GetAttributes(DeploymentAddAttributeContext addContext)
{
    if (this.BaseContext.IsDestinationObject)
    {
        // if we are on the destination and the file doesn't exist then we need to throw an exception
        // to ensure that the file gets synced. This happens because the Add command will be called for us.

        // Since I'm throwing an exception here Add will always be called, we could check to see if this file
        // was up-to-date and if so then skip this exception.
        throw new DeploymentException();
    }
    else
    {
        // We are acting on the source object here, make sure that the file exists on disk
        if (!File.Exists(this.FilePath))
        {
            string message = string.Format(&amp;quot;File &amp;lt;{0}&amp;gt; does not exist&amp;quot;,this.FilePath);
            throw new DeploymentFatalException(message);
        }
    }

    base.GetAttributes(addContext);
}&lt;/pre&gt;
&lt;p&gt;
For the most part the only thing left for this simple provider to implement is to
override the &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.web.deployment.deploymentobjectprovider.add.aspx"&gt;Add&lt;/a&gt; method.
First I will show the method then discuss its content. Here is the method.
&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;public override void Add(DeploymentObject source, bool whatIf)
{
    // This is called on the Destination so this.FilePath is the dest path not source path
    if (!whatIf &amp;amp;&amp;amp; File.Exists(source.ProviderContext.Path))
    {
        // We can let MSDeploy do the actual sync for us using existig provider
        DeploymentProviderOptions sourceProviderOptions = new DeploymentProviderOptions(DeploymentWellKnownProvider.FilePath);
        sourceProviderOptions.Path = source.ProviderContext.Path;

        using (DeploymentObject sourceObject = DeploymentManager.CreateObject(sourceProviderOptions, new DeploymentBaseOptions()))
        {
            DeploymentProviderOptions destProviderOptions = new DeploymentProviderOptions(DeploymentWellKnownProvider.FilePath);
            destProviderOptions.Path = this.FilePath;

            // Make the call to perform an actual sync
            sourceObject.SyncTo(destProviderOptions, new DeploymentBaseOptions(), new DeploymentSyncOptions());
        }
    }
}&lt;/pre&gt;
&lt;p&gt;
First I check to make sure that we are not doing a whatif run (i.e. a run where we
don’t want to physically perform the action) and that the source file exists. Take
note of the fact that I’m explicitly using &lt;strong&gt;source.ProviderContext.Path&lt;/strong&gt; to
get the source path. This provider has a property, FilePath, which contains the path
but it could be either source path or dest path depending on which end you are executing
in. the source.ProviderContent.Path will always point to the source value. After that
you can see that I’m actually leveraging an existing provider the &lt;a href="http://technet.microsoft.com/en-us/library/ee207414%28WS.10%29.aspx"&gt;FilePath
provider&lt;/a&gt; to do the actual sync for me. So all the dirty work is his job! If you
are writing a provider make sure to re-use any existing providers that you can, because
the code for this part looks like it can get nasty. I’ll leave that for another post.
&lt;/p&gt;
&lt;p&gt;
After I prepare the source options I create an instance of the &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.web.deployment.deploymentobject.aspx"&gt;DeploymentObject&lt;/a&gt; class,
prepare the FilePath provider and call &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.web.deployment.deploymentobject.syncto.aspx"&gt;SyncTo&lt;/a&gt; on
the object., this is where the physical sync occurs. That is basically it for the
provider itself now we need to create a provider factory class which is the guy who
knows how to create our providers for us.
&lt;/p&gt;
&lt;p&gt;
Fortunately creating custom provider factories is even easier then creating custom
providers themselves. I called mine CustomFileProviderFactory and the entire class
is shown below.
&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;[DeploymentProviderFactory]
public class CustomFileProviderFactory : DeploymentProviderFactory
{
    protected override DeploymentObjectProvider Create(DeploymentProviderContext providerContext, DeploymentBaseContext baseContext)
    {
        return new CustomFileProvider(providerContext, baseContext);
    }

    public override string Description
    {
        get { return @&amp;quot;Custom provider to copy a file&amp;quot;; }
    }

    public override string ExamplePath
    {
        get { return @&amp;quot;c:\somefile.txt&amp;quot;; }
    }

    public override string FriendlyName
    {
        get { return &amp;quot;customFile&amp;quot;; }
    }
    public override string Name
    {
        get { return &amp;quot;customFile&amp;quot;; }
    }
}&lt;/pre&gt;
&lt;p&gt;
A few things to make note of; your class should extend the &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.web.deployment.deploymentproviderfactory.aspx"&gt;DeploymentProviderFactory&lt;/a&gt; class
and it should have the &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.web.deployment.deploymentproviderfactoryattribute.aspx"&gt;DeploymentProviderFactory&lt;/a&gt; attribute
attached to it. Besides that there are two properties FriendlyName and Name, once
again in all the samples I have seen they are always the same and always equal to
the Name property on the provider itself. I followed suit and copied them. I’m still
trying to figure out more about what each of these actually do, but for now I’m OK
with leaving them to be the same. So that is basically it.
&lt;/p&gt;
&lt;p&gt;
In order to have MSDeploy use the provider you have to create a folder named Extensibility
under the &lt;strong&gt;&lt;em&gt;%Program Files%\IIS\Microsoft Web Deploy&lt;/em&gt;&lt;/strong&gt; folder
if it doesn’t exist, and then copy the assembly into that folder. And then you are
good to go. Here is the snippet showing my custom provider in action!
&lt;/p&gt;
&lt;pre class="brush: plain;"&gt;C:\temp\MSDeploy&amp;gt;msdeploy -verb:sync -source:customFile=C:\temp\MSDeploy\Source\source.txt -dest:customFile=C:\temp
\MSDeploy\Dest\one.txt -verbose
Verbose: Performing synchronization pass #1.
Info: Adding MSDeploy.customFile (MSDeploy.customFile).
Info: Adding customFile (C:\temp\MSDeploy\Dest\one.txt).
Verbose: The dependency check 'DependencyCheckInUse' found no issues.
Verbose: The synchronization completed in 1 pass(es).
Total changes: 2 (2 added, 0 deleted, 0 updated, 0 parameters changed, 0 bytes copied)&lt;/pre&gt;
&lt;p&gt;
This was a pretty basic provider, but you have to start somewhere. I will post more
about custom providers as I find out more.
&lt;/p&gt;
&lt;p&gt;
&lt;font size="3"&gt;You can download the entire source at &lt;/font&gt;&lt;a title="http://sedotech.com/Resources#CustomProviders" href="http://sedotech.com/Resources#CustomProviders"&gt;&lt;font size="3"&gt;http://sedotech.com/Resources#CustomProviders&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt; under
the Custom Providers heading of the &lt;/font&gt;&lt;a href="http://sedotech.com/Resources#MSDeploy"&gt;&lt;font size="3"&gt;MSDeploy&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt; section.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,bd37422c-41b7-450d-ada5-122251483b53.aspx</comments>
      <category>Custom Provider</category>
      <category>MSDeploy</category>
      <category>Web Deployment Tool</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=317a6dbd-fdc6-4238-bda4-916e208fe702</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,317a6dbd-fdc6-4238-bda4-916e208fe702.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,317a6dbd-fdc6-4238-bda4-916e208fe702.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=317a6dbd-fdc6-4238-bda4-916e208fe702</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I just received a message from a reader asking about how he can extend the package
process in Visual Studio 2010 RC to include files that his web project doesn't contain
or reference. If you are not familiar with this Visual Studio 2010 has support for
creating Web Packages now. These packages can be used with the <a href="http://www.iis.net/expand/WebDeploy">Web
Deployment Tool</a> to simply deployments. The Web Deployment Tool is also known as
MSDeploy.
</p>
        <p>
He was actually asking about including external dependencies, but in this post I will
show how to include some text files which are already written to disk. To extend this
to use those dependencies should be pretty easy. Here is what I did: 
</p>
        <ol>
          <li>
Created a new ASP.NET MVC 2 Project (because he stated this is what he has) 
</li>
          <li>
Added a folder named Extra Files one folder above where the .csproj file is located
and put a few files there 
</li>
          <li>
In Visual Studio right clicked on the project selected “Unload Project” 
</li>
          <li>
In Visual Studio right clicked on the project selected “Edit project” 
</li>
        </ol>
        <p>
Then at the bottom of the project file (<em>right above the &lt;/Project&gt; statement</em>).
I inserted the following XML fragments.
</p>
        <pre class="brush: xml;">&lt;PropertyGroup&gt;
  &lt;CopyAllFilesToSingleFolderForPackageDependsOn&gt;
    CustomCollectFiles;
    $(CopyAllFilesToSingleFolderForPackageDependsOn);
  &lt;/CopyAllFilesToSingleFolderForPackageDependsOn&gt;
&lt;/PropertyGroup&gt;
&lt;Target Name="CustomCollectFiles"&gt;
  &lt;ItemGroup&gt;
    &lt;_CustomFiles Include="..\Extra Files\**\*"&gt;
      &lt;DestinationRelativePath&gt;%(RecursiveDir)%(Filename)%(Extension)&lt;/DestinationRelativePath&gt;
    &lt;/_CustomFiles&gt;

    &lt;FilesForPackagingFromProject  Include="%(_CustomFiles.Identity)"&gt;
      &lt;DestinationRelativePath&gt;Extra Files\%(RecursiveDir)%(Filename)%(Extension)&lt;/DestinationRelativePath&gt;
    &lt;/FilesForPackagingFromProject&gt;
  &lt;/ItemGroup&gt;
&lt;/Target&gt;</pre>
        <p>
Here I do a few things. First I extend the <strong>CopyAllFilesToSingleFolderForPackage</strong> target
by extending its DependsOn property to include my target <strong>CustomCollectFiles</strong>.
This will inject my target at the right time into the Web Publishing Pipeline. Inside
that target I need to add my files into the <strong>FilesForPackagingFromProject</strong> item
group, but I must do so in a particular manner. Specifically I have to define the
relative path to where it should be written. This captured inside the DestinationRelativePath
metadata item. This is required because sometimes you may have a file which is named,
or in a different folder, than it was originally. After you do that you will see that
the web package that is created when you create a web package from Visual Studio (or
from the command line using msbuild.exe for that matter) contains your custom files.
</p>
        <p>
I just posted a blog about my upcoming talk discussing <a href="http://sedodream.com/2010/03/10/SpeakingOnAutomatingWebDeploymentsAndASPNETMVC.aspx">Web
Deployments and ASP.NET MVC</a>, once again check it out :)
</p>
        <p>
Sayed Ibrahim Hashimi
</p>
      </body>
      <title>Web Deployment Tool: Including other Files</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,317a6dbd-fdc6-4238-bda4-916e208fe702.aspx</guid>
      <link>http://sedodream.com/2010/03/10/WebDeploymentToolIncludingOtherFiles.aspx</link>
      <pubDate>Wed, 10 Mar 2010 05:26:14 GMT</pubDate>
      <description>&lt;p&gt;
I just received a message from a reader asking about how he can extend the package
process in Visual Studio 2010 RC to include files that his web project doesn't contain
or reference. If you are not familiar with this Visual Studio 2010 has support for
creating Web Packages now. These packages can be used with the &lt;a href="http://www.iis.net/expand/WebDeploy"&gt;Web
Deployment Tool&lt;/a&gt; to simply deployments. The Web Deployment Tool is also known as
MSDeploy.
&lt;/p&gt;
&lt;p&gt;
He was actually asking about including external dependencies, but in this post I will
show how to include some text files which are already written to disk. To extend this
to use those dependencies should be pretty easy. Here is what I did: 
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Created a new ASP.NET MVC 2 Project (because he stated this is what he has) 
&lt;/li&gt;
&lt;li&gt;
Added a folder named Extra Files one folder above where the .csproj file is located
and put a few files there 
&lt;/li&gt;
&lt;li&gt;
In Visual Studio right clicked on the project selected “Unload Project” 
&lt;/li&gt;
&lt;li&gt;
In Visual Studio right clicked on the project selected “Edit project” 
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Then at the bottom of the project file (&lt;em&gt;right above the &amp;lt;/Project&amp;gt; statement&lt;/em&gt;).
I inserted the following XML fragments.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;PropertyGroup&amp;gt;
  &amp;lt;CopyAllFilesToSingleFolderForPackageDependsOn&amp;gt;
    CustomCollectFiles;
    $(CopyAllFilesToSingleFolderForPackageDependsOn);
  &amp;lt;/CopyAllFilesToSingleFolderForPackageDependsOn&amp;gt;
&amp;lt;/PropertyGroup&amp;gt;
&amp;lt;Target Name=&amp;quot;CustomCollectFiles&amp;quot;&amp;gt;
  &amp;lt;ItemGroup&amp;gt;
    &amp;lt;_CustomFiles Include=&amp;quot;..\Extra Files\**\*&amp;quot;&amp;gt;
      &amp;lt;DestinationRelativePath&amp;gt;%(RecursiveDir)%(Filename)%(Extension)&amp;lt;/DestinationRelativePath&amp;gt;
    &amp;lt;/_CustomFiles&amp;gt;

    &amp;lt;FilesForPackagingFromProject  Include=&amp;quot;%(_CustomFiles.Identity)&amp;quot;&amp;gt;
      &amp;lt;DestinationRelativePath&amp;gt;Extra Files\%(RecursiveDir)%(Filename)%(Extension)&amp;lt;/DestinationRelativePath&amp;gt;
    &amp;lt;/FilesForPackagingFromProject&amp;gt;
  &amp;lt;/ItemGroup&amp;gt;
&amp;lt;/Target&amp;gt;&lt;/pre&gt;
&lt;p&gt;
Here I do a few things. First I extend the &lt;strong&gt;CopyAllFilesToSingleFolderForPackage&lt;/strong&gt; target
by extending its DependsOn property to include my target &lt;strong&gt;CustomCollectFiles&lt;/strong&gt;.
This will inject my target at the right time into the Web Publishing Pipeline. Inside
that target I need to add my files into the &lt;strong&gt;FilesForPackagingFromProject&lt;/strong&gt; item
group, but I must do so in a particular manner. Specifically I have to define the
relative path to where it should be written. This captured inside the DestinationRelativePath
metadata item. This is required because sometimes you may have a file which is named,
or in a different folder, than it was originally. After you do that you will see that
the web package that is created when you create a web package from Visual Studio (or
from the command line using msbuild.exe for that matter) contains your custom files.
&lt;/p&gt;
&lt;p&gt;
I just posted a blog about my upcoming talk discussing &lt;a href="http://sedodream.com/2010/03/10/SpeakingOnAutomatingWebDeploymentsAndASPNETMVC.aspx"&gt;Web
Deployments and ASP.NET MVC&lt;/a&gt;, once again check it out :)
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,317a6dbd-fdc6-4238-bda4-916e208fe702.aspx</comments>
      <category>Deployment</category>
      <category>MSDeploy</category>
      <category>Web Deployment Tool</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=b00f5c6b-40a2-4107-99f2-4db0b38bbd8d</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,b00f5c6b-40a2-4107-99f2-4db0b38bbd8d.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,b00f5c6b-40a2-4107-99f2-4db0b38bbd8d.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=b00f5c6b-40a2-4107-99f2-4db0b38bbd8d</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I will be speaking at the <a href="http://orlandocodecamp.com">Orlando Code Camp</a> on
Saturday March 27. I will be giving two session; one on <strong>Simplifying deployments
with MSDeploy and Visual Studio 2010</strong> and the other on <strong>ASP.NET MVC
View Helpers</strong>. By the way, the other name for MSDeploy is the Web Deployment
Tool.
</p>
        <p>
If you have ever had issues with deploying web applications (<em>which includes everyone
who has ever deployed a web app :) </em>) then you need to attend my session. I will
discuss the three major scenarios of deploying web applications:
</p>
        <ul>
          <li>
Deploying to a local IIS server</li>
          <li>
Deploying to an IIS server on the intranet</li>
          <li>
Deploying to a 3rd party host</li>
        </ul>
        <p>
I will be demonstrating how to perform 2 of the 3; deploying to local IIS server and
to a 3rd party host. Since I won’t have any other machines besides my notebook I will
not be demoing how to deploy to an IIS server on the intranet, but it is very similar
to the other 2 scenarios. There has been a lot of work in the area of web deployment
(<em>deployment in general actually</em>) recently which could really help spare you
of a lot of headache. I presented this at the <a href="http://www.fladotnet.com/codecamp/">South
Florida Code Camp</a> a couple weeks ago and a person actually stated in the session
“<strong>There are a lot of people who wish they were in here right now</strong>”!
If you are in the area then you should attend my session, you won’t regret it.
</p>
        <p>
Here is the abstract:
</p>
        <p>
          <em>Visual Studio 2010 will be shipped including integration with Microsoft’s Web
Deployment Tool, MSDeploy. For quite a while web deployments have been very difficult
to manage and automate. With MSDeploy you can manage the complexities of web deployments.
One of the great aspects of the Web Deployment Tool is that it is integrated into
Visual Studio with MSBuild tasks and targets. Since Team Foundation Build can leverage
MSBuild we can take advantage of those tasks and targets to automate web deployments
using Team Build.</em>
        </p>
        <p>
My other talk will be on creating leaner views with ASP.NET MVC View Helpers. If you
are using ASP.NET MVC then this is one of the sessions you’ll be interested in. I
will be getting in depth about ASP.NET View Helpers, and just talking ASP.NET MVC
in general. I gave this talk at the <a href="http://jaxdug.com/">Jacksonville Developers
User Group</a> last week and it was great. I’m very excited about these two talks,
I’m sure they will be great. Here is the abstract.
</p>
        <p>
If you have been using ASP.NETMVC then you certainly have been using some of the built
in view helper methods that are available, you know those expressions like Html.TextBox("textBoxName")
and Html.ValidationMessage("Required"). View helpers are nothing more than
extension methods which create HTML that is injected into your views based on the
method and its parameters. Creating your own view helpers is very simple and can be
extremely beneficial. By writing your own custom view helpers you will benefit in
at least the following ways 
</p>
        <ul>
          <li>
Simplifies Your Views 
</li>
          <li>
Eases Re-hydrating HTML Elements with ModelState Values 
</li>
          <li>
Standardizes the Creation of Common HTML Components 
</li>
          <li>
Helps you Implement the DRY (Don’t Repeat Yourself) Principal 
</li>
        </ul>
        <p>
I have published a 22 page paper discussing custom ASP.NET MVC view helpers along
with a sample app at <a title="http://mvcviewhelpers.codeplex.com/" href="http://mvcviewhelpers.codeplex.com/">http://mvcviewhelpers.codeplex.com/</a> if
you are interested.
</p>
        <p>
 
</p>
        <p>
If you are in the area this weekend its going to be a great event. I think there were
&gt;400 people there last year, so it should be a good turn out this year as well.
I hope to see you there.
</p>
        <p>
Sayed Ibrahim Hashimi
</p>
      </body>
      <title>Speaking on Automating Web Deployments and ASP.NET MVC</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,b00f5c6b-40a2-4107-99f2-4db0b38bbd8d.aspx</guid>
      <link>http://sedodream.com/2010/03/10/SpeakingOnAutomatingWebDeploymentsAndASPNETMVC.aspx</link>
      <pubDate>Wed, 10 Mar 2010 03:29:22 GMT</pubDate>
      <description>&lt;p&gt;
I will be speaking at the &lt;a href="http://orlandocodecamp.com"&gt;Orlando Code Camp&lt;/a&gt; on
Saturday March 27. I will be giving two session; one on &lt;strong&gt;Simplifying deployments
with MSDeploy and Visual Studio 2010&lt;/strong&gt; and the other on &lt;strong&gt;ASP.NET MVC
View Helpers&lt;/strong&gt;. By the way, the other name for MSDeploy is the Web Deployment
Tool.
&lt;/p&gt;
&lt;p&gt;
If you have ever had issues with deploying web applications (&lt;em&gt;which includes everyone
who has ever deployed a web app :) &lt;/em&gt;) then you need to attend my session. I will
discuss the three major scenarios of deploying web applications:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Deploying to a local IIS server&lt;/li&gt;
&lt;li&gt;
Deploying to an IIS server on the intranet&lt;/li&gt;
&lt;li&gt;
Deploying to a 3rd party host&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
I will be demonstrating how to perform 2 of the 3; deploying to local IIS server and
to a 3rd party host. Since I won’t have any other machines besides my notebook I will
not be demoing how to deploy to an IIS server on the intranet, but it is very similar
to the other 2 scenarios. There has been a lot of work in the area of web deployment
(&lt;em&gt;deployment in general actually&lt;/em&gt;) recently which could really help spare you
of a lot of headache. I presented this at the &lt;a href="http://www.fladotnet.com/codecamp/"&gt;South
Florida Code Camp&lt;/a&gt; a couple weeks ago and a person actually stated in the session
“&lt;strong&gt;There are a lot of people who wish they were in here right now&lt;/strong&gt;”!
If you are in the area then you should attend my session, you won’t regret it.
&lt;/p&gt;
&lt;p&gt;
Here is the abstract:
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;Visual Studio 2010 will be shipped including integration with Microsoft’s Web
Deployment Tool, MSDeploy. For quite a while web deployments have been very difficult
to manage and automate. With MSDeploy you can manage the complexities of web deployments.
One of the great aspects of the Web Deployment Tool is that it is integrated into
Visual Studio with MSBuild tasks and targets. Since Team Foundation Build can leverage
MSBuild we can take advantage of those tasks and targets to automate web deployments
using Team Build.&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
My other talk will be on creating leaner views with ASP.NET MVC View Helpers. If you
are using ASP.NET MVC then this is one of the sessions you’ll be interested in. I
will be getting in depth about ASP.NET View Helpers, and just talking ASP.NET MVC
in general. I gave this talk at the &lt;a href="http://jaxdug.com/"&gt;Jacksonville Developers
User Group&lt;/a&gt; last week and it was great. I’m very excited about these two talks,
I’m sure they will be great. Here is the abstract.
&lt;/p&gt;
&lt;p&gt;
If you have been using ASP.NETMVC then you certainly have been using some of the built
in view helper methods that are available, you know those expressions like Html.TextBox(&amp;quot;textBoxName&amp;quot;)
and Html.ValidationMessage(&amp;quot;Required&amp;quot;). View helpers are nothing more than
extension methods which create HTML that is injected into your views based on the
method and its parameters. Creating your own view helpers is very simple and can be
extremely beneficial. By writing your own custom view helpers you will benefit in
at least the following ways 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Simplifies Your Views 
&lt;/li&gt;
&lt;li&gt;
Eases Re-hydrating HTML Elements with ModelState Values 
&lt;/li&gt;
&lt;li&gt;
Standardizes the Creation of Common HTML Components 
&lt;/li&gt;
&lt;li&gt;
Helps you Implement the DRY (Don’t Repeat Yourself) Principal 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
I have published a 22 page paper discussing custom ASP.NET MVC view helpers along
with a sample app at &lt;a title="http://mvcviewhelpers.codeplex.com/" href="http://mvcviewhelpers.codeplex.com/"&gt;http://mvcviewhelpers.codeplex.com/&lt;/a&gt; if
you are interested.
&lt;/p&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
If you are in the area this weekend its going to be a great event. I think there were
&amp;gt;400 people there last year, so it should be a good turn out this year as well.
I hope to see you there.
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,b00f5c6b-40a2-4107-99f2-4db0b38bbd8d.aspx</comments>
      <category>MSDeploy</category>
      <category>speaking</category>
      <category>Visual Studio 2010</category>
      <category>Web Deployment Tool</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=76a85963-5401-4b12-b103-3c5c71d23fbf</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,76a85963-5401-4b12-b103-3c5c71d23fbf.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,76a85963-5401-4b12-b103-3c5c71d23fbf.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=76a85963-5401-4b12-b103-3c5c71d23fbf</wfw:commentRss>
      <title>MSDeploy Syncing 2 or More Folders</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,76a85963-5401-4b12-b103-3c5c71d23fbf.aspx</guid>
      <link>http://sedodream.com/2009/12/07/MSDeploySyncing2OrMoreFolders.aspx</link>
      <pubDate>Mon, 07 Dec 2009 04:50:37 GMT</pubDate>
      <description>&lt;p&gt;
A while back someone asked me if you could sync 2 or more folders with one statement
using &lt;a href="http://www.iis.net/expand/WebDeploymentTool"&gt;MSDeploy&lt;/a&gt;. I said of
course, if you perform the sync using &lt;a href="http://technet.microsoft.com/en-us/library/dd568976(WS.10).aspx"&gt;manifest&lt;/a&gt; files.
Manifest files allow you to "group" sync operations into a file. When you invoke msdeploy.exe
and point it to a manifest file, each provider will be executed in the order in which
it appears inside the manifest file. A common scenario for using manifest files is
to sync websites. This way you can specify the files that should be synced, the website
(application) name, ACL values, etc. But you are not limited to using manifest files
for web related sync operations. When using manifest files, you would specify the
provider to be &lt;strong&gt;&lt;em&gt;manifest&lt;/em&gt;&lt;/strong&gt;. We will see this in the command
used to snyc two folders. Often times when using a manifest file for the source you
will also use one for the destination. Here are the two files. 
&lt;/p&gt;
&lt;h2&gt;SourceManifest.xml 
&lt;/h2&gt;
&lt;p style="BACKGROUND: #d9d9d9"&gt;
&lt;span style="FONT-FAMILY: Consolas; COLOR: green; FONT-SIZE: 9pt"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;h2&gt;
&lt;div style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; PADDING-BOTTOM: 1pt; PADDING-LEFT: 4pt; PADDING-RIGHT: 4pt; BACKGROUND: #d9d9d9; BORDER-TOP: windowtext 1pt solid; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 1pt; mso-element: para-border-div; mso-border-alt: solid windowtext .5pt; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;
&lt;p style="MARGIN: 10pt 0in 0pt; BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=Code-BlockCxSpFirst&gt;
&lt;font color=#008000 size=2 face=Consolas&gt;&amp;lt;sitemanifest&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt; BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=Code-BlockCxSpMiddle&gt;
&lt;font size=2&gt;&lt;font color=#008000&gt;&lt;font face=Consolas&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;contentPath
path="C:\temp\MSDeploy\Source01"/&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt; BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=Code-BlockCxSpMiddle&gt;
&lt;font size=2&gt;&lt;font color=#008000&gt;&lt;font face=Consolas&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;contentPath
path="C:\temp\MSDeploy\Source02" /&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt; BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=Code-BlockCxSpLast&gt;
&lt;font color=#008000 size=2 face=Consolas&gt;&amp;lt;/sitemanifest&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/h2&gt;
&lt;h2&gt;DestManifest.xml 
&lt;/h2&gt;
&lt;p style="BACKGROUND: #d9d9d9"&gt;
&lt;span style="FONT-FAMILY: Consolas; COLOR: green; FONT-SIZE: 9pt"&gt;&lt;strong&gt;
&lt;/p&gt;
&lt;div style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; PADDING-BOTTOM: 1pt; PADDING-LEFT: 4pt; PADDING-RIGHT: 4pt; BACKGROUND: #d9d9d9; BORDER-TOP: windowtext 1pt solid; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 1pt; mso-element: para-border-div; mso-border-alt: solid windowtext .5pt; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;
&lt;p style="MARGIN: 10pt 0in 0pt; BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=Code-BlockCxSpFirst&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;
&amp;lt;sitemanifest&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt; BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=Code-BlockCxSpMiddle&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;contentPath path="E:\temp\MSDeploy\Source01"
/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt; BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=Code-BlockCxSpMiddle&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;contentPath path="E:\temp\MSDeploy\Source02"
/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt; BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=Code-BlockCxSpLast&gt;
&amp;lt;/sitemanifest&amp;gt;
&lt;/p&gt;
&lt;/div&gt;
&gt;&gt; 
&lt;p&gt;
In this example I am syncing two folders C:\temp\MSDeploy\Source01 and C:\temp\MSDeploy\Source02
to another drive location on E. The command to perform the sync would be 
&lt;/p&gt;
&lt;p style="BACKGROUND: #d9d9d9"&gt;
&lt;span style="FONT-FAMILY: Consolas; COLOR: green; FONT-SIZE: 9pt"&gt;&lt;strong&gt;msdeploy
-verb:sync -source:manifest=sourceManifest.xml -dest:manifest=destManifest.xml &lt;/strong&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
And here are the results of that sync operation, when the destination directories
don't exist. 
&lt;/p&gt;
&lt;span style="FONT-FAMILY: Consolas; COLOR: green; FONT-SIZE: 9pt"&gt;&lt;strong&gt; 
&lt;div style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; PADDING-BOTTOM: 1pt; PADDING-LEFT: 4pt; PADDING-RIGHT: 4pt; BACKGROUND: #d9d9d9; BORDER-TOP: windowtext 1pt solid; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 1pt; mso-element: para-border-div; mso-border-alt: solid windowtext .5pt; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;
&lt;p style="MARGIN: 10pt 0in 0pt; BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=Code-BlockCxSpFirst&gt;
C:\temp\MSDeploy&amp;gt;msdeploy -verb:sync -source:manifest=sourceManifest.xml -dest:manifest=destManifest.xml&lt;o:p&gt;&lt;/o:p&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt; BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=Code-BlockCxSpMiddle&gt;
Info: Adding sitemanifest (sitemanifest).&lt;o:p&gt;&lt;/o:p&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt; BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=Code-BlockCxSpMiddle&gt;
Info: Adding contentPath (E:\temp\MSDeploy\Source01).&lt;o:p&gt;&lt;/o:p&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt; BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=Code-BlockCxSpMiddle&gt;
Info: Adding dirPath (E:\temp\MSDeploy\Source01).&lt;o:p&gt;&lt;/o:p&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt; BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=Code-BlockCxSpMiddle&gt;
Info: Adding child filePath (E:\temp\MSDeploy\Source01\01.txt).&lt;o:p&gt;&lt;/o:p&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt; BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=Code-BlockCxSpMiddle&gt;
Info: Adding child filePath (E:\temp\MSDeploy\Source01\02.txt).&lt;o:p&gt;&lt;/o:p&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt; BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=Code-BlockCxSpMiddle&gt;
Info: Adding child filePath (E:\temp\MSDeploy\Source01\03.txt).&lt;o:p&gt;&lt;/o:p&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt; BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=Code-BlockCxSpMiddle&gt;
Info: Adding child filePath (E:\temp\MSDeploy\Source01\04.txt).&lt;o:p&gt;&lt;/o:p&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt; BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=Code-BlockCxSpMiddle&gt;
Info: Adding contentPath (E:\temp\MSDeploy\Source02).&lt;o:p&gt;&lt;/o:p&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt; BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=Code-BlockCxSpMiddle&gt;
Info: Adding dirPath (E:\temp\MSDeploy\Source02).&lt;o:p&gt;&lt;/o:p&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt; BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=Code-BlockCxSpMiddle&gt;
Info: Adding child filePath (E:\temp\MSDeploy\Source02\01.txt).&lt;o:p&gt;&lt;/o:p&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt; BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=Code-BlockCxSpMiddle&gt;
Info: Adding child filePath (E:\temp\MSDeploy\Source02\02.txt).&lt;o:p&gt;&lt;/o:p&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt; BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=Code-BlockCxSpMiddle&gt;
Info: Adding child filePath (E:\temp\MSDeploy\Source02\03.txt).&lt;o:p&gt;&lt;/o:p&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt; BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=Code-BlockCxSpMiddle&gt;
Info: Adding child filePath (E:\temp\MSDeploy\Source02\04.txt).&lt;o:p&gt;&lt;/o:p&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt; BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=Code-BlockCxSpLast&gt;
Total changes: 13 (13 added, 0 deleted, 0 updated, 0 parameters changed, 0 bytes copied)
&lt;/p&gt;
&lt;/strong&gt;&lt;/span&gt;&gt;
&lt;p&gt;
As you can see the destination directories were created and the files synced into
the destination folders. First all the content of the Source01 folder is synced and
then the Source02 folder as expected. If you perform the sync operation and all files
are up-to-date then no changes will be made. 
&lt;/p&gt;
&lt;p&gt;
This is just a very basic example of how you can use MSDeploy manifest files to perform
a sync operation, but you can create manifest files that perform many different actions.
Visual Studio 2010 uses manifest files when it creates the web packages for deployment. 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,76a85963-5401-4b12-b103-3c5c71d23fbf.aspx</comments>
      <category>MSDeploy</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=3871fbcb-d0aa-42f8-86e4-10179035233e</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,3871fbcb-d0aa-42f8-86e4-10179035233e.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,3871fbcb-d0aa-42f8-86e4-10179035233e.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=3871fbcb-d0aa-42f8-86e4-10179035233e</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Last week I <a href="http://sedodream.com/2009/10/09/MSDeployInteractiveOnlineSession.aspx">presented</a><a href="http://www.iis.net/webdeploymenttool">MSDeploy</a> in
a LiveMeeting session. I'm glad to say that the presentation is now available at <a href="https://www.livemeeting.com/cc/mvp/view?id=PR7D6Z">https://www.livemeeting.com/cc/mvp/view?id=PR7D6Z</a>.
If you are interested in getting a quick look at MSDeploy then this is a good place
to start. I demonstrate how we can use MSDeploy / VS2010 in the following scenarios. 
</p>
        <ul>
          <li>
Publish from VS 2010 to third party host 
</li>
          <li>
Publish from msdeploy.exe to local IIS 
</li>
          <li>
Publish from msdeploy.exe to remote IIS (within your intranet) 
</li>
        </ul>
        <p>
To my knowledge this is the first online presentation of the RTW version of MSDeploy. 
</p>
        <p>
You can download the slide deck at <a href="http://sedodream.com/content/binary/MSDeploy_Sayed-Ibrahim-Hashimi-2009-10.pdf">http://sedodream.com/content/binary/MSDeploy_Sayed-Ibrahim-Hashimi-2009-10.pdf</a></p>
        <p>
        </p>
        <p>
For reference here are the links from the resources slide 
</p>
        <ul>
          <li>
            <a href="http://vishaljoshi.blogspot.com/">http://www.iis.net/extensions/WebDeploymentTool</a>
          </li>
          <li>
            <a href="http://vishaljoshi.blogspot.com/">http://vishaljoshi.blogspot.com/</a>
          </li>
          <li>
            <a href="http://blogs.iis.net/msdeploy/default.aspx">http://blogs.iis.net/msdeploy/default.aspx</a>
          </li>
          <li>
            <a href="http://forums.iis.net/1144.aspx">http://forums.iis.net/1144.aspx</a>
          </li>
          <li>
            <a href="http://www.sedodream.com/">http://www.sedodream.com</a>
            <em>(more content
to come)</em>
          </li>
        </ul>
        <p>
        </p>
        <p>
I would like to thank <a href="http://blogs.msdn.com/charles_sterling/">Charles Sterling</a>, <a href="http://vishaljoshi.blogspot.com/">Vishal
Joshi</a>, and Mei Liang for making this happen. 
</p>
        <p>
Sayed Ibrahim Hashimi
</p>
      </body>
      <title>MSDeploy Presentation Materials</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,3871fbcb-d0aa-42f8-86e4-10179035233e.aspx</guid>
      <link>http://sedodream.com/2009/10/27/MSDeployPresentationMaterials.aspx</link>
      <pubDate>Tue, 27 Oct 2009 03:21:20 GMT</pubDate>
      <description>&lt;p&gt;
Last week I &lt;a href="http://sedodream.com/2009/10/09/MSDeployInteractiveOnlineSession.aspx"&gt;presented&lt;/a&gt; &lt;a href="http://www.iis.net/webdeploymenttool"&gt;MSDeploy&lt;/a&gt; in
a LiveMeeting session. I'm glad to say that the presentation is now available at &lt;a href="https://www.livemeeting.com/cc/mvp/view?id=PR7D6Z"&gt;https://www.livemeeting.com/cc/mvp/view?id=PR7D6Z&lt;/a&gt;.
If you are interested in getting a quick look at MSDeploy then this is a good place
to start. I demonstrate how we can use MSDeploy / VS2010 in the following scenarios. 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Publish from VS 2010 to third party host 
&lt;/li&gt;
&lt;li&gt;
Publish from msdeploy.exe to local IIS 
&lt;/li&gt;
&lt;li&gt;
Publish from msdeploy.exe to remote IIS (within your intranet) 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
To my knowledge this is the first online presentation of the RTW version of MSDeploy. 
&lt;/p&gt;
&lt;p&gt;
You can download the slide deck at &lt;a href="http://sedodream.com/content/binary/MSDeploy_Sayed-Ibrahim-Hashimi-2009-10.pdf"&gt;http://sedodream.com/content/binary/MSDeploy_Sayed-Ibrahim-Hashimi-2009-10.pdf&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
For reference here are the links from the resources slide 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://vishaljoshi.blogspot.com/"&gt;http://www.iis.net/extensions/WebDeploymentTool&lt;/a&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://vishaljoshi.blogspot.com/"&gt;http://vishaljoshi.blogspot.com/&lt;/a&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://blogs.iis.net/msdeploy/default.aspx"&gt;http://blogs.iis.net/msdeploy/default.aspx&lt;/a&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://forums.iis.net/1144.aspx"&gt;http://forums.iis.net/1144.aspx&lt;/a&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://www.sedodream.com/"&gt;http://www.sedodream.com&lt;/a&gt; &lt;em&gt;(more content
to come)&lt;/em&gt; 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
I would like to thank &lt;a href="http://blogs.msdn.com/charles_sterling/"&gt;Charles Sterling&lt;/a&gt;, &lt;a href="http://vishaljoshi.blogspot.com/"&gt;Vishal
Joshi&lt;/a&gt;, and Mei Liang for making this happen. 
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,3871fbcb-d0aa-42f8-86e4-10179035233e.aspx</comments>
      <category>MSDeploy</category>
      <category>Presentations</category>
    </item>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=9e1fdde2-eb09-4647-9aad-2190fbdfbb2f</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,9e1fdde2-eb09-4647-9aad-2190fbdfbb2f.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,9e1fdde2-eb09-4647-9aad-2190fbdfbb2f.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=9e1fdde2-eb09-4647-9aad-2190fbdfbb2f</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I will be giving an online <a href="http://office.microsoft.com/en-us/livemeeting/default.aspx">LiveMeeting</a> Session
hosted by <a href="http://www.microsoft.com/en/us/default.aspx">Microsoft</a> next
week on Wednesday October 14, 2009 at 4 PDT (Redmond Time). The title is Simplifying
Deployment with the Web Deployment Tool (MSDeploy). If you are not aware of <a href="http://www.iis.net/extensions/WebDeploymentTool">MSDeploy</a> it
is a newly released tool to ease the pain of deploying ASP.NET sites. If you are doing
any type of deployment of ASP.NET sites (Manual or Automated) then you must check
out MSDeploy, it will change how you look at deployment of ASP.NET sites all together.
Right now there is not an abundant amount of knowledge or material available on this
tool, but I think that will change soon. Hopefully I can contribute to some of that.
In any case, if you are available I would love to have you check out my session. There
will be some guys from Microsoft on the line including the Program Manager of the
Web Deployment Tool <a href="http://vishaljoshi.blogspot.com/">Vishal Joshi</a>. I'm
sure he will chime in when I try to mislead you guys by feeding your mis-information. 
</p>
        <p>
Here is the info about the presentation. 
</p>
        <p>
          <span style="color:#333333; font-family:Georgia">
            <strong>
              <em>Simplifying Deployment
with the Web Deployment Tool (MSDeploy)</em>
            </strong>
          </span>
        </p>
        <p>
          <span style="color:#333333; font-family:Georgia">You are invited to join the talk
which is scheduled for </span>
        </p>
        <p>
          <span style="color:#333333; font-family:Georgia">
            <strong>Wednesday, October 14<sup>th</sup>,
2009 | 4:00pm – 5:00pm (PDT, Redmond time)</strong>
          </span>
        </p>
        <p>
          <span style="color:#333333; font-family:Georgia">
            <strong>Abstract</strong>
          </span>
        </p>
        <p>
          <span style="color:#333333; font-family:Georgia">Deploying ASP.NET Websites has always
been a challenge and different teams have used different approaches to overcoming
those challenges. Microsoft has offered some support for making deployment easier
in the past. For instance they first introduced Web Deployment Projects for Visual
Studio 2005, and also have a version for 2008. Web Deployment Projects do greatly
simplify the process of calling the aspnet_compiler and aspnet_merge tool but even
though their title states "Deployment" they had no support for physically deploying
the site. Now Microsoft has introduced the Web Deployment Tool, also known as MSDeploy.
MSDeploy will bridge the gap between taking a web site and physically deploying it
to its destination. With MSDeploy you can easily and very effectively perform tasks
such as pushing an ASP.NET site (Web site, Web Application Project, ASP.NET, etc)
from one machine to several other machines. This is achieved by the target machines
having the MSDeploy Remote Agent Service installed and running. You can sync two different
Web Sites that are hosted in IIS, you can create a web package (simply a .zip file)
and use that as your source, you can sync two different folders, and many other options.
Another compelling feature of MSDeploy is that it will be integrated into Visual Studio
2010. From Visual Studio 2010 you can compile your ASP.NET Web Application Project
and then create the Web Package which contains all your content files plus IIS settings.
This one file will full describe your web. </span>
        </p>
        <p>
          <span style="color:#333333; font-family:Georgia">
            <strong>Live Meeting Information</strong>
          </span>
        </p>
        <p>
          <a href="https://www.livemeeting.com/cc/mvp/join?id=PR7D6Z&amp;role=attend&amp;pw=A5128ML0Y0D">
            <span style="font-family:Georgia">
              <strong>Join
the meeting.</strong>
            </span>
          </a>
          <span style="color:#333333; font-family:Georgia">
            <br />
            <strong>Audio Information</strong>
            <br />
            <strong>Computer Audio</strong>
            <br />
To use computer audio, you need speakers and microphone, or a headset. 
<br /><strong>Telephone conferencing</strong><br />
Use the information below to connect: 
<br />
Toll-free: +1 (866) 500-6738 
<br />
Toll: +1 (203) 480-8000 
<br />
Participant code: 5460396 </span>
        </p>
        <p>
          <span style="color:#333333; font-family:Georgia">
            <strong>Please join 10 minutes prior
to the start time.</strong>
          </span>
        </p>
        <p>
          <span style="font-family:Georgia">
            <span style="color:#333333">
              <strong>First Time Users:</strong>
              <br />
To save time before the meeting, <a href="http://go.microsoft.com/fwlink/?LinkId=90703" /></span>check
your system<span style="color:#333333"> to make sure it is ready to use Microsoft
Office Live Meeting. 
<br /><strong>Notes</strong></span></span>
        </p>
        <p>
          <span style="color:#333333; font-family:Georgia">
            <strong>Troubleshooting</strong>
            <br />
Unable to join the meeting? Follow these steps: </span>
        </p>
        <p>
          <span style="font-family:Georgia">
            <span style="color:#333333">1. Copy this address
and paste it into your web browser: 
<br /><a href="https://www.livemeeting.com/cc/mvp/join" /></span>https://www.livemeeting.com/cc/mvp/join<span style="color:#333333"></span></span>
        </p>
        <p>
          <span style="font-family:Georgia">
            <span style="color:#333333">2. Copy and paste the
required information: 
<br />
Meeting ID: PR7D6Z 
<br />
Entry Code: A5128ML0Y0D 
<br />
Location: <a href="https://www.livemeeting.com/cc/mvp" /></span>https://www.livemeeting.com/cc/mvp<span style="color:#333333"></span></span>
        </p>
        <p>
          <span style="font-family:Georgia">
            <span style="color:#333333">If you still cannot
enter the meeting, <a href="http://r.office.microsoft.com/r/rlidLiveMeeting?p1=12&amp;p2=en_US&amp;p3=LMInfo&amp;p4=support" /></span>contact
support<span style="color:#333333"></span></span>
        </p>
        <p>
          <span style="color:#333333; font-family:Georgia">
            <strong>Note</strong>
          </span>
        </p>
        <p>
          <span style="color:#333333; font-family:Georgia">Microsoft Office Live Meeting can
be used to record meetings. By participating in this meeting, you agree that your
communications may be monitored or recorded at any time during the meeting. </span>
        </p>
        <p>
        </p>
        <p>
Sayed Ibrahim Hashimi 
</p>
        <p>
        </p>
        <p>
        </p>
      </body>
      <title>MSDeploy: Interactive Online Session</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,9e1fdde2-eb09-4647-9aad-2190fbdfbb2f.aspx</guid>
      <link>http://sedodream.com/2009/10/09/MSDeployInteractiveOnlineSession.aspx</link>
      <pubDate>Fri, 09 Oct 2009 02:43:27 GMT</pubDate>
      <description>&lt;p&gt;
I will be giving an online &lt;a href="http://office.microsoft.com/en-us/livemeeting/default.aspx"&gt;LiveMeeting&lt;/a&gt; Session
hosted by &lt;a href="http://www.microsoft.com/en/us/default.aspx"&gt;Microsoft&lt;/a&gt; next
week on Wednesday October 14, 2009 at 4 PDT (Redmond Time). The title is Simplifying
Deployment with the Web Deployment Tool (MSDeploy). If you are not aware of &lt;a href="http://www.iis.net/extensions/WebDeploymentTool"&gt;MSDeploy&lt;/a&gt; it
is a newly released tool to ease the pain of deploying ASP.NET sites. If you are doing
any type of deployment of ASP.NET sites (Manual or Automated) then you must check
out MSDeploy, it will change how you look at deployment of ASP.NET sites all together.
Right now there is not an abundant amount of knowledge or material available on this
tool, but I think that will change soon. Hopefully I can contribute to some of that.
In any case, if you are available I would love to have you check out my session. There
will be some guys from Microsoft on the line including the Program Manager of the
Web Deployment Tool &lt;a href="http://vishaljoshi.blogspot.com/"&gt;Vishal Joshi&lt;/a&gt;. I'm
sure he will chime in when I try to mislead you guys by feeding your mis-information. 
&lt;/p&gt;
&lt;p&gt;
Here is the info about the presentation. 
&lt;/p&gt;
&lt;p&gt;
&lt;span style="color:#333333; font-family:Georgia"&gt;&lt;strong&gt;&lt;em&gt;Simplifying Deployment
with the Web Deployment Tool (MSDeploy)&lt;/em&gt;&lt;/strong&gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="color:#333333; font-family:Georgia"&gt;You are invited to join the talk
which is scheduled for &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="color:#333333; font-family:Georgia"&gt;&lt;strong&gt;Wednesday, October 14&lt;sup&gt;th&lt;/sup&gt;,
2009 | 4:00pm – 5:00pm (PDT, Redmond time)&lt;/strong&gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="color:#333333; font-family:Georgia"&gt;&lt;strong&gt;Abstract&lt;/strong&gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="color:#333333; font-family:Georgia"&gt;Deploying ASP.NET Websites has always
been a challenge and different teams have used different approaches to overcoming
those challenges. Microsoft has offered some support for making deployment easier
in the past. For instance they first introduced Web Deployment Projects for Visual
Studio 2005, and also have a version for 2008. Web Deployment Projects do greatly
simplify the process of calling the aspnet_compiler and aspnet_merge tool but even
though their title states "Deployment" they had no support for physically deploying
the site. Now Microsoft has introduced the Web Deployment Tool, also known as MSDeploy.
MSDeploy will bridge the gap between taking a web site and physically deploying it
to its destination. With MSDeploy you can easily and very effectively perform tasks
such as pushing an ASP.NET site (Web site, Web Application Project, ASP.NET, etc)
from one machine to several other machines. This is achieved by the target machines
having the MSDeploy Remote Agent Service installed and running. You can sync two different
Web Sites that are hosted in IIS, you can create a web package (simply a .zip file)
and use that as your source, you can sync two different folders, and many other options.
Another compelling feature of MSDeploy is that it will be integrated into Visual Studio
2010. From Visual Studio 2010 you can compile your ASP.NET Web Application Project
and then create the Web Package which contains all your content files plus IIS settings.
This one file will full describe your web. &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="color:#333333; font-family:Georgia"&gt;&lt;strong&gt;Live Meeting Information&lt;/strong&gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="https://www.livemeeting.com/cc/mvp/join?id=PR7D6Z&amp;amp;role=attend&amp;amp;pw=A5128ML0Y0D"&gt;&lt;span style="font-family:Georgia"&gt;&lt;strong&gt;Join
the meeting.&lt;/strong&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="color:#333333; font-family:Georgia"&gt; 
&lt;br /&gt;
&lt;strong&gt;Audio Information&lt;/strong&gt; 
&lt;br /&gt;
&lt;strong&gt;Computer Audio&lt;/strong&gt; 
&lt;br /&gt;
To use computer audio, you need speakers and microphone, or a headset. 
&lt;br /&gt;
&lt;strong&gt;Telephone conferencing&lt;/strong&gt; 
&lt;br /&gt;
Use the information below to connect: 
&lt;br /&gt;
Toll-free: +1 (866) 500-6738 
&lt;br /&gt;
Toll: +1 (203) 480-8000 
&lt;br /&gt;
Participant code: 5460396 &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="color:#333333; font-family:Georgia"&gt;&lt;strong&gt;Please join 10 minutes prior
to the start time.&lt;/strong&gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="font-family:Georgia"&gt;&lt;span style="color:#333333"&gt;&lt;strong&gt;First Time Users:&lt;/strong&gt; 
&lt;br /&gt;
To save time before the meeting, &lt;a href="http://go.microsoft.com/fwlink/?LinkId=90703" /&gt;&lt;/span&gt;check
your system&lt;span style="color:#333333"&gt; to make sure it is ready to use Microsoft
Office Live Meeting. 
&lt;br /&gt;
&lt;strong&gt;Notes&lt;/strong&gt; &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="color:#333333; font-family:Georgia"&gt;&lt;strong&gt;Troubleshooting&lt;/strong&gt; 
&lt;br /&gt;
Unable to join the meeting? Follow these steps: &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="font-family:Georgia"&gt;&lt;span style="color:#333333"&gt;1. Copy this address
and paste it into your web browser: 
&lt;br /&gt;
&lt;a href="https://www.livemeeting.com/cc/mvp/join" /&gt;&lt;/span&gt;https://www.livemeeting.com/cc/mvp/join&lt;span style="color:#333333"&gt; &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="font-family:Georgia"&gt;&lt;span style="color:#333333"&gt;2. Copy and paste the
required information: 
&lt;br /&gt;
Meeting ID: PR7D6Z 
&lt;br /&gt;
Entry Code: A5128ML0Y0D 
&lt;br /&gt;
Location: &lt;a href="https://www.livemeeting.com/cc/mvp" /&gt;&lt;/span&gt;https://www.livemeeting.com/cc/mvp&lt;span style="color:#333333"&gt; &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="font-family:Georgia"&gt;&lt;span style="color:#333333"&gt;If you still cannot
enter the meeting, &lt;a href="http://r.office.microsoft.com/r/rlidLiveMeeting?p1=12&amp;amp;p2=en_US&amp;amp;p3=LMInfo&amp;amp;p4=support" /&gt;&lt;/span&gt;contact
support&lt;span style="color:#333333"&gt; &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="color:#333333; font-family:Georgia"&gt;&lt;strong&gt;Note&lt;/strong&gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="color:#333333; font-family:Georgia"&gt;Microsoft Office Live Meeting can
be used to record meetings. By participating in this meeting, you agree that your
communications may be monitored or recorded at any time during the meeting. &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,9e1fdde2-eb09-4647-9aad-2190fbdfbb2f.aspx</comments>
      <category>Deployment</category>
      <category>LiveMeeting</category>
      <category>MSDeploy</category>
      <category>Video</category>
    </item>
  </channel>
</rss>