When automating web publishing for Visual Studio projects in many cases your first
step will be to create a publish profile for the project in VS. There are many cases
in which you cannot, or would not like to do this. In this post I’ll show you how
you can take an existing project and use an MSBuild file to drive the publish process.
In that I’ll also show how you can extend the publish process without modifying either
the project or any of its contents.

In this snippet we are passing in a handful of properties. VisualStudioVersion dictates
which version of MSBuild targets are used during the build. See http://sedodream.com/2012/08/19/VisualStudioProjectCompatabilityAndVisualStudioVersion.aspx for
more details on that. DeployOnBuild=true injects the publish process at the end of
build. PublishProfile can either be the name of a publish profile which the project
contains or it can be the full path to a publish profile. We will
use PublishProfile with that second option, the full path.

So we need to pass in the full path to a publish profile, which typically is a .pubxml
file. A publish profile is just an MSBuild file. When you pass in PublishProfile and
DeployOnBuild=true, then the publish profile is Imported into the build/publish process.
It will supply the publish properties needed to perform the publish.

Let’s see how that works. I have a sample project, MySite, which does not have any
publish profiles created for it. I have created a publish profile, ToFileSys.pubxml,
in another folder that will be used though. The contents of that file are below.

This publish profile will publish to a local folder. I just created this file in VS
with a different project and then just copied it to the folder that I needed, and
removed properties which are only used for the inside of VS experience. We can publish
the MySite project using this profile with the command below.

When you execute this the file specified in PublishProfile will be included into the
build process.

Taking it up a level

Now let’s see how we can take this to the next level by having a single script that
will be used to publish more than one project using this technique.

In the sample files (which you can find links for at the end of the post).
I have a solution with two web projects, MySite and MyOtherSite. Neither of these
projects have any publish profiles created. I have created a script which will build/publish
these projects which you can find at build\publish.proj in the samples. The
contents of the file are shown below.

publish.proj

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="BuildProjects">
<!--
This file is used in two ways.
1. Drive the build and publish process
2. It is used by the publish process during the build of MySite to configure/extend publish
Note: 1. Is kicked off by the use on the cmd line/build server. 2. Is invoked by this script itself.
This file is injected into the publish process via the PublishProfile property.
-->
<PropertyGroup>
<VisualStudioVersion Condition=" '$(VisualStudioVersion)'=='' ">11.0</VisualStudioVersion>
<Configuration Condition=" '$(Configuration)'=='' ">Release</Configuration>
<!-- Location for build output of the project -->
<OutputRoot Condition=" '$(OutputRoot)'=='' ">$(MSBuildThisFileDirectory)..\BuildOutput\</OutputRoot>
<!-- Root for the publish output -->
<PublishFolder Condition=" '$(PublishFolder)'==''">C:\temp\Publish\Output\</PublishFolder>
</PropertyGroup>
<ItemGroup>
<ProjectsToBuild Include="$(MSBuildThisFileDirectory)..\MySite\MySite.csproj">
<AdditionalProperties>
VisualStudioVersion=$(VisualStudioVersion);
Configuration=$(Configuration);
OutputPath=$(OutputRoot);
WebPublishMethod=FileSystem;
publishUrl=$(PublishFolder)MySite\;
DeployOnBuild=true;
DeployTarget=WebPublish;
PublishProfile=$(MSBuildThisFileFullPath)
</AdditionalProperties>
</ProjectsToBuild>
<ProjectsToBuild Include="$(MSBuildThisFileDirectory)..\MyOtherSite\MyOtherSite.csproj">
<AdditionalProperties>
VisualStudioVersion=$(VisualStudioVersion);
Configuration=$(Configuration);
OutputPath=$(OutputRoot);
WebPublishMethod=FileSystem;
publishUrl=$(PublishFolder)MyOtherSite\;
DeployOnBuild=true;
DeployTarget=WebPublish;
PublishProfile=$(MSBuildThisFileFullPath)
</AdditionalProperties>
</ProjectsToBuild>
</ItemGroup>
<Target Name="BuildProjects">
<MSBuild Projects="@(ProjectsToBuild)" />
</Target>
<!-- ***************************************************************************************
The targets below will be called during the publish process.
These targets are injected into the publish process for each web project.
These targets will not have access to any new values for properties/items from
the targets above this.
*************************************************************************************** -->
<Target Name="AfterWebPublish" AfterTargets="WebPublish">
<Message Text="Inside AfterWebPublish" Importance="high"/>
</Target>
</Project>

This file is pretty simple, it declares some properties which will be used for the
build/publish process. Then it declares the projects to be built with an item list
named ProjectsToBuild. When declaring ProjectsToBuild I use the
AdditionalProperties metadata to specify MSBuild properties to be used during the
build process for each project. Let’s take a closer look at those properties.

I’ll explain all the properties now. VisualStudioVersion, Configuration and OutputPath
are all used for the build process. The other properties are related to publishing.
If you want to publish from the file system those properties (WebPublishMethod,
publishUrl, DeployOnBuild, and DeployTarget) must be set. The most important
property there is PublishProfile.

PublishProfile is set to $(MSBuildThisFileFullPath) which is the full path to publish.proj.
This will instruct the build process of that project to import publish.proj when its
build/publish process is started. It’s important to note that a “new instance” of
the file will be imported. What that means is that the imported version of publish.proj
won’t have access to any dynamic properties/items created in publish.proj.

The reason why PublishProfile is specified there is so that we can extend the publish
process from within publish.proj itself. publish.proj has a target, AfterWebPublish,
which will be executed after each project is executed. Let’s see how this works.

We can execute the publish process with the command below.

msbuild .\build\publish.proj /p:VisualStudioVersion=11.0

After executing this command the tail end of the result is shown in the image below.

In the image above you can see that the MyOtherSite project is being publish to the
specified location in publish.proj and the AfterWebPublish target is executed as well.

In this post we’ve seen how we can use an MSBuild file as a publish profile, and how
to extend the publish process using that same file.

How to extend the web publish process without modifying project contentshttp://sedodream.com/PermaLink,guid,14e3bfc5-b31f-4994-917d-411e3c7d8240.aspxhttp://sedodream.com/2013/09/21/HowToExtendTheWebPublishProcessWithoutModifyingProjectContents.aspx
Sat, 21 Sep 2013 18:57:03 GMT<p>
When automating web publishing for Visual Studio projects in many cases your first
step will be to create a publish profile for the project in VS. There are many cases
in which you cannot, or would not like to do this. In this post I’ll show you how
you can take an existing project and use an MSBuild file to drive the publish process.
In that I’ll also show how you can extend the publish process without modifying either
the project or any of its contents.
</p>
<p>
Before we get too far into this, if you are not familiar with how to publish your
VS web projects from the command line you can read our docs at <a href="http://www.asp.net/mvc/tutorials/deployment/visual-studio-web-deployment/command-line-deployment">ttp://www.asp.net/mvc/tutorials/deployment/visual-studio-web-deployment/command-line-deployment</a>.
</p>
<p>
When you publish a project from the command line using a publish profile you typically
use the syntax below.
</p>
<pre class="brush: xml;">msbuild .\MyProject.csproj /p:VisualStudioVersion=11.0 /p:DeployOnBuild=true /p:PublishProfile=&lt;profile-name-or-path&gt;
</pre>
<p>
In this snippet we are passing in a handful of properties. VisualStudioVersion dictates
which version of MSBuild targets are used during the build. See <a href="http://sedodream.com/2012/08/19/VisualStudioProjectCompatabilityAndVisualStudioVersion.aspx">http://sedodream.com/2012/08/19/VisualStudioProjectCompatabilityAndVisualStudioVersion.aspx</a> for
more details on that. DeployOnBuild=true injects the publish process at the end of
build. PublishProfile can either be the name of a publish profile which the project
contains <strong>or it can be the full path to a publish profile</strong>. We will
use PublishProfile with that second option, the full path.
</p>
<p>
So we need to pass in the full path to a publish profile, which typically is a .pubxml
file. A publish profile is just an MSBuild file. When you pass in PublishProfile and
DeployOnBuild=true, then the publish profile is Imported into the build/publish process.
It will supply the publish properties needed to perform the publish.
</p>
<p>
Let’s see how that works. I have a sample project, MySite, which does not have any
publish profiles created for it. I have created a publish profile, ToFileSys.pubxml,
in another folder that will be used though. The contents of that file are below.
</p>
<p>
<strong><u>ToFileSys.pubxml</u></strong>
</p>
<pre class="brush: xml;">&lt;Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
&lt;PropertyGroup&gt;
&lt;WebPublishMethod&gt;FileSystem&lt;/WebPublishMethod&gt;
&lt;ExcludeApp_Data&gt;False&lt;/ExcludeApp_Data&gt;
&lt;publishUrl&gt;C:\temp\Publish\01&lt;/publishUrl&gt;
&lt;DeleteExistingFiles&gt;False&lt;/DeleteExistingFiles&gt;
&lt;/PropertyGroup&gt;
&lt;/Project&gt;
</pre>
<p>
This publish profile will publish to a local folder. I just created this file in VS
with a different project and then just copied it to the folder that I needed, and
removed properties which are only used for the inside of VS experience. We can publish
the MySite project using this profile with the command below.
</p>
<pre class="brush: xml;">msbuild MySite.csproj
/p:VisualStudioVersion=11.0
/p:DeployOnBuild=true
/p:PublishProfile=C:\data\my-code\publish-samples\publish-injection\build\ToFileSys.pubxml
</pre>
<p>
When you execute this the file specified in PublishProfile will be included into the
build process.
</p>
<h3>Taking it up a level
</h3>
<p>
<a href="http://sedodream.com/content/binary/WindowsLiveWriter/Howtoextendthewebpublishprocesswithoutmo_9E9F/steps_2.jpg"><img title="steps" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="steps" src="http://sedodream.com/content/binary/WindowsLiveWriter/Howtoextendthewebpublishprocesswithoutmo_9E9F/steps_thumb.jpg" width="644" height="445"></a>
</p>
<p>
Now let’s see how we can take this to the next level by having a single script that
will be used to publish more than one project using this technique.
</p>
<p>
In the sample files (<em>which you can find links for at the end of the post</em>).
I have a solution with two web projects, MySite and MyOtherSite. Neither of these
projects have any publish profiles created. I have created a script which will build/publish
these projects which you can find at <em>build\publish.proj</em> in the samples. The
contents of the file are shown below.
</p>
<p>
<strong><u>publish.proj</u></strong>
</p>
<pre class="brush: xml;">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="BuildProjects"&gt;
&lt;!--
This file is used in two ways.
1. Drive the build and publish process
2. It is used by the publish process during the build of MySite to configure/extend publish
Note: 1. Is kicked off by the use on the cmd line/build server. 2. Is invoked by this script itself.
This file is injected into the publish process via the PublishProfile property.
--&gt;
&lt;PropertyGroup&gt;
&lt;VisualStudioVersion Condition=" '$(VisualStudioVersion)'=='' "&gt;11.0&lt;/VisualStudioVersion&gt;
&lt;Configuration Condition=" '$(Configuration)'=='' "&gt;Release&lt;/Configuration&gt;
&lt;!-- Location for build output of the project --&gt;
&lt;OutputRoot Condition=" '$(OutputRoot)'=='' "&gt;$(MSBuildThisFileDirectory)..\BuildOutput\&lt;/OutputRoot&gt;
&lt;!-- Root for the publish output --&gt;
&lt;PublishFolder Condition=" '$(PublishFolder)'==''"&gt;C:\temp\Publish\Output\&lt;/PublishFolder&gt;
&lt;/PropertyGroup&gt;
&lt;ItemGroup&gt;
&lt;ProjectsToBuild Include="$(MSBuildThisFileDirectory)..\MySite\MySite.csproj"&gt;
&lt;AdditionalProperties&gt;
VisualStudioVersion=$(VisualStudioVersion);
Configuration=$(Configuration);
OutputPath=$(OutputRoot);
WebPublishMethod=FileSystem;
publishUrl=$(PublishFolder)MySite\;
DeployOnBuild=true;
DeployTarget=WebPublish;
PublishProfile=$(MSBuildThisFileFullPath)
&lt;/AdditionalProperties&gt;
&lt;/ProjectsToBuild&gt;
&lt;ProjectsToBuild Include="$(MSBuildThisFileDirectory)..\MyOtherSite\MyOtherSite.csproj"&gt;
&lt;AdditionalProperties&gt;
VisualStudioVersion=$(VisualStudioVersion);
Configuration=$(Configuration);
OutputPath=$(OutputRoot);
WebPublishMethod=FileSystem;
publishUrl=$(PublishFolder)MyOtherSite\;
DeployOnBuild=true;
DeployTarget=WebPublish;
PublishProfile=$(MSBuildThisFileFullPath)
&lt;/AdditionalProperties&gt;
&lt;/ProjectsToBuild&gt;
&lt;/ItemGroup&gt;
&lt;Target Name="BuildProjects"&gt;
&lt;MSBuild Projects="@(ProjectsToBuild)" /&gt;
&lt;/Target&gt;
&lt;!-- ***************************************************************************************
The targets below will be called during the publish process.
These targets are injected into the publish process for each web project.
These targets will not have access to any new values for properties/items from
the targets above this.
*************************************************************************************** --&gt;
&lt;Target Name="AfterWebPublish" AfterTargets="WebPublish"&gt;
&lt;Message Text="Inside AfterWebPublish" Importance="high"/&gt;
&lt;/Target&gt;
&lt;/Project&gt;
</pre>
<p>
This file is pretty simple, it declares some properties which will be used for the
build/publish process. Then it declares the projects to be built with an item list
named <em>ProjectsToBuild</em>. When declaring <em>ProjectsToBuild</em> I use the
AdditionalProperties metadata to specify MSBuild properties to be used during the
build process for each project. Let’s take a closer look at those properties.
</p>
<pre class="brush: xml;">&lt;AdditionalProperties&gt;
VisualStudioVersion=$(VisualStudioVersion);
Configuration=$(Configuration);
OutputPath=$(OutputRoot);
WebPublishMethod=FileSystem;
publishUrl=$(PublishFolder)MySite\;
DeployOnBuild=true;
DeployTarget=WebPublish;
PublishProfile=$(MSBuildThisFileFullPath)
&lt;/AdditionalProperties&gt;
</pre>
<p>
I’ll explain all the properties now. VisualStudioVersion, Configuration and OutputPath
are all used for the build process. The other properties are related to publishing.
If you want to publish from the file system those properties (<em>WebPublishMethod,
publishUrl, DeployOnBuild, and DeployTarget</em>) must be set. The most important
property there is PublishProfile.
</p>
<p>
PublishProfile is set to $(MSBuildThisFileFullPath) which is the full path to publish.proj.
This will instruct the build process of that project to import publish.proj when its
build/publish process is started. It’s important to note that a “new instance” of
the file will be imported. What that means is that the imported version of publish.proj
won’t have access to any dynamic properties/items created in publish.proj.
</p>
<p>
The reason why PublishProfile is specified there is so that we can extend the publish
process from within publish.proj itself. publish.proj has a target, AfterWebPublish,
which will be executed after each project is executed. Let’s see how this works.
</p>
<p>
We can execute the publish process with the command below.
</p>
<pre class="brush: xml;">msbuild .\build\publish.proj /p:VisualStudioVersion=11.0
</pre>
<p>
After executing this command the tail end of the result is shown in the image below.
</p>
<p>
<a href="http://sedodream.com/content/binary/WindowsLiveWriter/Howtoextendthewebpublishprocesswithoutmo_9E9F/image_2.png"><img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://sedodream.com/content/binary/WindowsLiveWriter/Howtoextendthewebpublishprocesswithoutmo_9E9F/image_thumb.png" width="893" height="463"></a>
</p>
<p>
In the image above you can see that the MyOtherSite project is being publish to the
specified location in publish.proj and the AfterWebPublish target is executed as well.
</p>
<p>
&nbsp;
</p>
<p>
In this post we’ve seen how we can use an MSBuild file as a publish profile, and how
to extend the publish process using that same file.
</p>
<p>
You can download the samples at <a title="https://dl.dropboxusercontent.com/u/40134810/blog/publish-injection.zip" href="https://dl.dropboxusercontent.com/u/40134810/blog/publish-injection.zip">https://dl.dropboxusercontent.com/u/40134810/blog/publish-injection.zip</a>.
You can find the latest version in my <a href="https://github.com/sayedihashimi/publish-samples">publish-samples</a> repository
at <a href="https://github.com/sayedihashimi/publish-samples/tree/master/publish-injection">publish-injection</a>.
</p>
<p>
Sayed Ibrahim Hashimi | <a href="http://msbuildbook.com">http://msbuildbook.com</a> | <a href="https://twitter.com/sayedihashimi">@SayedIHashimi</a>
</p>MSBuildVisual StudioVisual Studio 2012webWeb Publishing Pipelinehttp://sedodream.com/Trackback.aspx?guid=c3c50094-4ca6-451e-bba6-df797785b83ahttp://sedodream.com/pingback.aspxhttp://sedodream.com/PermaLink,guid,c3c50094-4ca6-451e-bba6-df797785b83a.aspxIbrahim

The easiest way to publish a Visual Studio web project from the command line is to
follow the steps below.

From the command line publish with the command line passing in PublishProfile

For more details on this you can see ASP.NET
Command Line Deployment. This is pretty simple and very easy, but it does require
that you manually create the .pubxml file. In some cases you’d just like to download
the .publishsettings file from your hosting provider and use that from the command
line. This post will show you how to do this.

In order to achieve the goal we will need to extend the build/publish process. There
are two simple ways to do this; 1. Place a .wpp.targets file in the same directory
as the web project or 2. Pass an additional property indicating the location of the
.wpp.targets file. I’ll first go over the technique where you place the file directly
inside of the directory where the project is. After that I’ll show you how to use
this file from a well known location.

One way to do this is to create a .wpp.targets file. This .wpp.targets file will be
imported into the build/publish process automatically. This .targets file will enable
us to pass in PublishSettingsFile as an MSBuild property. It will then read the .publishsettings
file and output the properties needed to execute the publish process.

.wpp.targets in the project directory

Let’s take a look at the .targets file and then we will discuss it’s contents. Below
you will find the contents of the full file.

You can place this file in the root of your project (next to the .csproj/.vbproj
file) with the name {ProjectName}.wpp.targets.

This .targets file is pretty simple. It defines a couple properties and a single target,
GetPublishPropertiesFromPublishSettings. In order to publish your project from the
command line you would execute the command below.

DeployOnBuild, when true it indicates that we want to publish the project. This is
the same property that you would normally pass in.

PublishSettingsFile, this is a new property which the .targets file recognizes. It
should be set to the path of the .publishSettings file.

The properties at the top of the .targets file (WebPublishMethod and DeployTarget)
indicate what type of publish operation is happening. The default values for those
are MSDeploy and WebPublish respectively. You shouldn’t need to change those, but
if you do you can pass them in on the command line.

The GetPublishPropertiesFromPublishSettings target uses the XmlPeek task
to read the .publishsettings file. It then emits the properties required for publishing.

OK this is great an all, but it still requires that an additional file (the .wpp.targets
file) be placed in the directory of project. It is possible to avoid this as well.
Let’s move to that

.wpp.targets from a well known location

If you’d like to avoid having to place the .wpp.targets file in the directory of the
project you can easily do this. Place the file in a well known location and then execute
the same msbuild.exe call adding an additional property. See the full command below.

How to publish a VS web project with a .publishSettings filehttp://sedodream.com/PermaLink,guid,c3c50094-4ca6-451e-bba6-df797785b83a.aspxhttp://sedodream.com/2013/06/05/HowToPublishAVSWebProjectWithAPublishSettingsFile.aspx
Wed, 05 Jun 2013 17:01:34 GMT<p>
The easiest way to publish a Visual Studio web project from the command line is to
follow the steps below.
</p>
<ol>
<li>
Open VS
<li>
Right click on the Web project and select Publish
<li>
Import your .publishSettings file (or manually configure the settings)
<li>
Save the profile (i.e. .pubxml file)
<li>
From the command line publish with the command line passing in PublishProfile</li>
</ol>
<p>
For more details on this you can see <a href="http://msbuild myproj.csproj /p:VisualStudioVersion=11.0 /pOpen-mouthed smileeploy">ASP.NET
Command Line Deployment</a>. This is pretty simple and very easy, but it does require
that you manually create the .pubxml file. In some cases you’d just like to download
the .publishsettings file from your hosting provider and use that from the command
line. This post will show you how to do this.
</p>
<p>
In order to achieve the goal we will need to extend the build/publish process. There
are two simple ways to do this; 1. Place a .wpp.targets file in the same directory
as the web project or 2. Pass an additional property indicating the location of the
.wpp.targets file. I’ll first go over the technique where you place the file directly
inside of the directory where the project is. After that I’ll show you how to use
this file from a well known location.
</p>
<p>
One way to do this is to create a .wpp.targets file. This .wpp.targets file will be
imported into the build/publish process automatically. This .targets file will enable
us to pass in PublishSettingsFile as an MSBuild property. It will then read the .publishsettings
file and output the properties needed to execute the publish process.
</p>
<h3>.wpp.targets in the project directory
</h3>
<p>
Let’s take a look at the .targets file and then we will discuss it’s contents. Below
you will find the contents of the full file.
</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;!--
When using this file you must supply /p:PublishSettingsFile as a parameter and /p:DeployOnBuild=true
--&gt;
&lt;PropertyGroup Condition=" Exists('$(PublishSettingsFile)')"&gt;
&lt;!-- These must be declared outside of a Target because they impact the Import Project flow --&gt;
&lt;WebPublishMethod&gt;MSDeploy&lt;/WebPublishMethod&gt;
&lt;DeployTarget&gt;WebPublish&lt;/DeployTarget&gt;
&lt;PipelineDependsOn&gt;
GetPublishPropertiesFromPublishSettings;
$(PipelineDependsOn);
&lt;/PipelineDependsOn&gt;
&lt;/PropertyGroup&gt;
&lt;Target Name="GetPublishPropertiesFromPublishSettings" BeforeTargets="Build" Condition=" Exists('$(PublishSettingsFile)')"&gt;
&lt;PropertyGroup&gt;
&lt;_BaseQuery&gt;/publishData/publishProfile[@publishMethod='MSDeploy'][1]/&lt;/_BaseQuery&gt;
&lt;!-- This value is not in the .publishSettings file and needs to be specified, it can be overridden with a cmd line parameter --&gt;
&lt;!-- If you are using the Remote Agent then specify this as RemoteAgent --&gt;
&lt;MSDeployPublishMethod&gt;WMSVC&lt;/MSDeployPublishMethod&gt;
&lt;/PropertyGroup&gt;
&lt;ItemGroup&gt;
&lt;_MSDeployXPath Include="WebPublishMethod"&gt;
&lt;Query&gt;$(_BaseQuery)@publishMethod&lt;/Query&gt;
&lt;/_MSDeployXPath&gt;
&lt;_MSDeployXPath Include="MSDeployServiceURL"&gt;
&lt;Query&gt;$(_BaseQuery)@publishUrl&lt;/Query&gt;
&lt;/_MSDeployXPath&gt;
&lt;_MSDeployXPath Include="SiteUrlToLaunchAfterPublish"&gt;
&lt;Query&gt;$(_BaseQuery)@destinationAppUrl&lt;/Query&gt;
&lt;/_MSDeployXPath&gt;
&lt;_MSDeployXPath Include="DeployIisAppPath"&gt;
&lt;Query&gt;$(_BaseQuery)@msdeploySite&lt;/Query&gt;
&lt;/_MSDeployXPath&gt;
&lt;_MSDeployXPath Include="UserName"&gt;
&lt;Query&gt;$(_BaseQuery)@userName&lt;/Query&gt;
&lt;/_MSDeployXPath&gt;
&lt;_MSDeployXPath Include="Password"&gt;
&lt;Query&gt;$(_BaseQuery)@userPWD&lt;/Query&gt;
&lt;/_MSDeployXPath&gt;
&lt;/ItemGroup&gt;
&lt;XmlPeek XmlInputPath="$(PublishSettingsFile)"
Query="%(_MSDeployXPath.Query)"
Condition=" Exists('$(PublishSettingsFile)')"&gt;
&lt;Output TaskParameter="Result" PropertyName="%(_MSDeployXPath.Identity)"/&gt;
&lt;/XmlPeek&gt;
&lt;/Target&gt;
&lt;/Project&gt;
</pre>
<p>
You can place this file in the root of your project (<em>next to the .csproj/.vbproj
file</em>) with the name <em>{ProjectName}.wpp.targets</em>.
</p>
<p>
This .targets file is pretty simple. It defines a couple properties and a single target,
GetPublishPropertiesFromPublishSettings. In order to publish your project from the
command line you would execute the command below.
</p>
<pre class="brush: csharp;">msbuild.exe MyProject /p:VisualStudioVersion=11.0 /p:DeployOnBuild=true /p:PublishSettingsFile=&lt;path-to-.publishsettings&gt;
</pre>
<p>
Here is some info on the properties that are being passed in.
</p>
<blockquote>
<p>
The VisualStudioVersion property indicates that we are using the VS 2012 targets.
More info on this at <a href="http://sedodream.com/2012/08/19/VisualStudioProjectCompatabilityAndVisualStudioVersion.aspx">http://sedodream.com/2012/08/19/VisualStudioProjectCompatabilityAndVisualStudioVersion.aspx</a>.
</p>
<p>
DeployOnBuild, when true it indicates that we want to publish the project. This is
the same property that you would normally pass in.
</p>
<p>
PublishSettingsFile, this is a new property which the .targets file recognizes. It
should be set to the path of the .publishSettings file.
</p>
</blockquote>
<p>
&nbsp;
</p>
<p>
The properties at the top of the .targets file (WebPublishMethod and DeployTarget)
indicate what type of publish operation is happening. The default values for those
are MSDeploy and WebPublish respectively. You shouldn’t need to change those, but
if you do you can pass them in on the command line.
</p>
<p>
The GetPublishPropertiesFromPublishSettings target uses the <a href="http://stackoverflow.com/questions/2688239/how-to-use-xmlpeek-task">XmlPeek</a> task
to read the .publishsettings file. It then emits the properties required for publishing.
</p>
<p>
OK this is great an all, but it still requires that an additional file (the .wpp.targets
file) be placed in the directory of project. It is possible to avoid this as well.
Let’s move to that
</p>
<h3>.wpp.targets from a well known location
</h3>
<p>
If you’d like to avoid having to place the .wpp.targets file in the directory of the
project you can easily do this. Place the file in a well known location and then execute
the same msbuild.exe call adding an additional property. See the full command below.
</p>
<pre class="brush: csharp;">msbuild.exe MyProject /p:VisualStudioVersion=11.0 /p:DeployOnBuild=true /p:PublishSettingsFile=&lt;path-to-.publishsettings&gt; /p:WebPublishPipelineCustomizeTargetFile=&lt;path-to.targets-file&gt;
</pre>
<p>
Once you do this you no longer need to create the Publish Profile in VS if you want
to publish from the command line with a .publishsettings file.
</p>
<p>
&nbsp;
</p>
<p>
FYI you can find the complete sample at <a href="https://github.com/sayedihashimi/publish-samples/tree/master/PubWithPublishSettings">https://github.com/sayedihashimi/publish-samples/tree/master/PubWithPublishSettings</a>.
</p>
<p>
&nbsp;
</p>
<p>
Sayed Ibrahim Hashimi | <a href="http://msbuildbook.com">http://msbuildbook.com</a> | <a href="https://twitter.com/sayedihashimi">@SayedIHashimi</a>
</p>MSBuildwebWeb Publishing Pipelinehttp://sedodream.com/Trackback.aspx?guid=19245c5f-8119-45bf-be6e-acc60ea53ed8http://sedodream.com/pingback.aspxhttp://sedodream.com/PermaLink,guid,19245c5f-8119-45bf-be6e-acc60ea53ed8.aspxIbrahim

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 siteone – Web Deploy.pubxml in the folder
Properties\PublishProfiles\. If the file doesn’t exist the operation may fail.

If you do this, when its time for ProjB to build it will fail because there’s no siteone
– Web Deploy profile for that project. Because of this, we cannot pass DeployOnBuild.
Instead here is what we need to do.

Edit ProjA.csproj to define another property which will conditionally set DeployOnBuild

From the command line pass in that property

I edited ProjA and added the following property group before the Import statements
in the .csproj file.

How to publish one web project from a solutionhttp://sedodream.com/PermaLink,guid,7d187729-cc9c-4654-8d15-a4bc4372f91d.aspxhttp://sedodream.com/2013/03/06/HowToPublishOneWebProjectFromASolution.aspx
Wed, 06 Mar 2013 02:48:41 GMT<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>
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>
From the command line pass in that property</li>
</ol>
<p>
&nbsp;
</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>
&nbsp;
</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>
&nbsp;
</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>
&nbsp;
</p>
<p>
Sayed Ibrahim Hashimi | <a href="https://twitter.com/sayedihashimi">@SayedIHashimi</a> | <a href="http://msbuildbook.com/">http://msbuildbook.com/</a>
</p>MSDeploywebWeb Deployment ToolWeb DevelopmentWeb Publishing Pipelinehttp://sedodream.com/Trackback.aspx?guid=0ead210a-209b-4f45-9fac-3c55162b2e53http://sedodream.com/pingback.aspxhttp://sedodream.com/PermaLink,guid,0ead210a-209b-4f45-9fac-3c55162b2e53.aspxIbrahim

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 Azure
SDK.

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.

Web Deploy – The preferred method. You can publish to any host/server
which has Web Deploy configured

Web Deploy Package - Used to create a package which can be
published offline at a later time

File system - Used to publish to a local/network folder

FTP - Used to publish to any FTP server

FPSE – Used to publish to a server using Front Page Server Extensions

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 http://aspnet.uservoice.com.
If there is enough interest we may work on that support.

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.

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.

FYI in case you haven’t already heard I’m working on an update to my book. More info
at msbuildbook.com

Command line web project publishinghttp://sedodream.com/PermaLink,guid,0ead210a-209b-4f45-9fac-3c55162b2e53.aspxhttp://sedodream.com/2013/01/06/CommandLineWebProjectPublishing.aspx
Sun, 06 Jan 2013 02:56:37 GMT<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>&#160; - Used to create a package which can be
published offline at a later time
</li>
<li>
<strong>File system</strong>&#160; - Used to publish to a local/network folder
</li>
<li>
<strong>FTP</strong>&#160; - 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>&#160; - 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>MSBuildMSBuild 4.0MSDeploywebWeb Deployment Toolhttp://sedodream.com/Trackback.aspx?guid=d611171d-d017-4d14-a131-9230df2d899ahttp://sedodream.com/pingback.aspxhttp://sedodream.com/PermaLink,guid,d611171d-d017-4d14-a131-9230df2d899a.aspxIbrahim

Web Deploy (aka MSDeploy) uses a provider model and there are a good
number of providers 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 contentPath provider.
You can also use this provider to sync a folder from one website to another website.

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.

msdeploy.exe -verb:sync -source:contentPath="" -dest:contentPath=""

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 C:\temp\files-to-pub. 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 sayedupdemo so the IIS path that I want to sync
is ‘sayedupdemo/files-to-pub’. Now that give us.

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.

ComputerName – this is the URL or computer name which will handle the publish operation

Username – the username

Password – the password

AuthType – the authType to
be used. Either NTLM or Basic. For WMSvc this is typically Basic, for Remote Agent
Service this is NTLM

All of these values can be found in the .publishSettings file (can be downloaded
from Web Site dashboard from WindowsAzure.com). 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 ?site=sayedupdemo, this is the same name as shown
in the Azure portal. So now the command which we have is.

At this point before I execute this command I’ll first execute it passing –whatif.
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.

After I verified that the changes are all intentional, I removed the –whatif 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.

Web Deploy (MSDeploy) how to sync a folderhttp://sedodream.com/PermaLink,guid,d611171d-d017-4d14-a131-9230df2d899a.aspxhttp://sedodream.com/2012/08/20/WebDeployMSDeployHowToSyncAFolder.aspx
Mon, 20 Aug 2012 03:08:11 GMT<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=&quot;&quot; -dest:contentPath=&quot;&quot;</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=&quot;C:\temp\files-to-pub&quot; -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=&quot;C:\temp\files-to-pub&quot;
-dest:contentPath='sayedupdemo/files-to-pub'
,ComputerName=&quot;https://waws-prod-blu-001.publish.azurewebsites.windows.net/msdeploy.axd?site=sayedupdemo&quot;
,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=&quot;C:\temp\files-to-pub&quot;
-dest:contentPath='sayedupdemo/files-to-pub'
,ComputerName=&quot;https://waws-prod-blu-001.publish.azurewebsites.windows.net/msdeploy.axd?site=sayedupdemo&quot;
,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 />
<pre class="brush: xml;">msdeploy.exe
-verb:sync
-source:contentPath=&quot;C:\temp\files-to-pub&quot;
-dest:auto
,ComputerName=&quot;https://waws-prod-blu-001.publish.azurewebsites.windows.net/msdeploy.axd?site=sayedupdemo&quot;
,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>MSDeployVisual StudiowebWeb Deployment Toolhttp://sedodream.com/Trackback.aspx?guid=a5894bad-f2a1-441a-a5b2-74f16c6cf8aahttp://sedodream.com/pingback.aspxhttp://sedodream.com/PermaLink,guid,a5894bad-f2a1-441a-a5b2-74f16c6cf8aa.aspxIbrahim

One of the most requested features of Visual Studio 2012 was the ability to open projects
in both VS 2012 as well as VS 2010 (requires VS 2010 SP1). In case you haven’t
heard we did implement that feature. You may be wondering how we were able to do this
and how this may impact you.

If you open the .csproj/.vbproj for a Web Project created in VS2010 you will see the
following import statement.

When you open this project in VS 2012 there are a few changes made to your project
file to ensure that it can be opened in both VS 2010 SP1 and VS 2012. One of the changes
made to the project when it is first loaded in VS 2012 is to add the following to
replace that import statement.

We removed the hard-coded 10.0 and instead used the property VisualStudioVersion.
When building in Visual Studio 2012 this value will always be 11.0, but for VS 2010
it doesn’t exist. That is why we defaulted it to 10.0 above.

There are some scenarios where building from the command line will require to set
this property explicitly. Before we get there let me explain how this property gets
set (in this order)

If VisualStudioVersion is defined as an environment variable/global MSBuild property,
that is used.

This is how VS and the VS developer command prompt set this value

Based on the file format version of the .sln file (toolset used is sln file format
–1)

To simplify this statement, the .sln file will build with specifying VisualStudioVersion
to the value of the version of VS which created the .sln file.

Choose default

10.0 if VS 2010 is installed

Highest-versioned sub-toolset version installed

For #2 when you are building a .sln file the value of VisulStudioVersion will be –1
of the Format Version found in the .sln file. The important thing to note here is
that if you build a .sln file it will build with the value of VisulStudioVersion corresponding
to the version of VS which created the .sln file. So if you create a .sln file in
VS2012 and you always build that .sln file the value for VisualStudioVersion will
be 11.0. In many cases if you build the .sln file you are good.

If you are building .csproj/.vbproj files w/o going through a .sln file? If you build
a web project from the command line (not the developer prompt) then the value
for VisualStudioVersion used will be 10.0. That is an artifact of the properties which
I showed above. In this case you should pass this in as an MSBuild property. For example

Visual Studio project compatability and VisualStudioVersionhttp://sedodream.com/PermaLink,guid,a5894bad-f2a1-441a-a5b2-74f16c6cf8aa.aspxhttp://sedodream.com/2012/08/19/VisualStudioProjectCompatabilityAndVisualStudioVersion.aspx
Sun, 19 Aug 2012 21:06:56 GMT<p>
One of the most requested features of Visual Studio 2012 was the ability to open projects
in both VS 2012 as well as VS 2010 (<em>requires VS 2010 SP1</em>). In case you haven’t
heard we did implement that feature. You may be wondering how we were able to do this
and how this may impact you.
</p>
<p>
If you open the .csproj/.vbproj for a Web Project created in VS2010 you will see the
following import statement.
</p>
<pre class="brush: xml;">&lt;Import Project=&quot;$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\<br />
v10.0\WebApplications\Microsoft.WebApplication.targets&quot; /&gt;</pre>
<p>
When you open this project in VS 2012 there are a few changes made to your project
file to ensure that it can be opened in both VS 2010 SP1 and VS 2012. One of the changes
made to the project when it is first loaded in VS 2012 is to add the following to
replace that import statement.
</p>
<pre class="brush: xml;">&lt;PropertyGroup&gt;
&lt;VisualStudioVersion Condition=&quot;'$(VisualStudioVersion)' == ''&quot;&gt;10.0&lt;/VisualStudioVersion&gt;
&lt;VSToolsPath Condition=&quot;'$(VSToolsPath)' == ''&quot;&gt;
$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)&lt;/VSToolsPath&gt;
&lt;/PropertyGroup&gt;
&lt;Import Project=&quot;$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets&quot; Condition=&quot;'$(VSToolsPath)' != ''&quot; /&gt;</pre>
<p>
We removed the hard-coded 10.0 and instead used the property <em>VisualStudioVersion</em>.
When building in Visual Studio 2012 this value will always be 11.0, but for VS 2010
it doesn’t exist. That is why we defaulted it to 10.0 above.
</p>
<p>
There are some scenarios where building from the command line will require to set
this property explicitly. Before we get there let me explain how this property gets
set (<em>in this order</em>)
</p>
<ol>
<li>
If VisualStudioVersion is defined as an environment variable/global MSBuild property,
that is used.</li>
<ul>
<li>
<em>This is how VS and the VS developer command prompt set this value</em>
</li>
</ul>
<li>
Based on the file format version of the .sln file (toolset used is sln file format
–1)</li>
<ul>
<li>
<em>To simplify this statement, the .sln file will build with specifying VisualStudioVersion
to the value of the version of VS which created the .sln file.</em>
</li>
</ul>
<li>
Choose default</li>
<ul>
<li>
10.0 if VS 2010 is installed</li>
<li>
Highest-versioned sub-toolset version installed</li>
</ul>
>
<p>
For #2 when you are building a .sln file the value of VisulStudioVersion will be –1
of the Format Version found in the .sln file. The important thing to note here is
that if you build a .sln file it will build with the value of VisulStudioVersion corresponding
to the version of VS which created the .sln file. So if you create a .sln file in
VS2012 and you always build that .sln file the value for VisualStudioVersion will
be 11.0. In many cases if you build the .sln file you are good.
</p>
<p>
If you are building .csproj/.vbproj files w/o going through a .sln file? If you build
a web project from the command line (<em>not the developer prompt</em>) then the value
for VisualStudioVersion used will be 10.0. That is an artifact of the properties which
I showed above. In this case you should pass this in as an MSBuild property. For example
</p>
<pre class="brush: xml;">msbuild.exe MyAwesomeWeb.csproj /p:VisualStudioVersion=11.0</pre>
<p>
In this case I’m passing in the property explicitly. This will always override any
other mechanism to determine the value for VisualStudioVersion. If you are using the <a href="http://msdn.microsoft.com/en-us/library/z7f65y0d.aspx">MSBuild
task</a> in a build script, then you can specify the property either in the Properties
attribute or the AdditionalProperties attribute. <em>See my previous </em><a href="http://sedodream.com/2009/04/29/MSBuildPropertiesAndAdditionalPropertiesKnownMetadata.aspx"><em>blog
post on the difference between Properties and AdditionalProperties</em></a><em>.</em>
</p>
<p>
If you encounter any funny behavior when building/publishing and you notice that the
wrong .targets files are being imported then you may need to specify this property.
</p>
<p>
Sayed Ibrahim Hashimi | <a href="https://twitter.com/sayedihashimi">@SayedIHashimi</a>
</p>MSBuildVisual StudioVisual Studio 11Visual Studio 2010Visual Studio 2012webWeb Publishing Pipelinehttp://sedodream.com/Trackback.aspx?guid=055c7ccf-e6a9-41e7-bcb8-db3bc65194f2http://sedodream.com/pingback.aspxhttp://sedodream.com/PermaLink,guid,055c7ccf-e6a9-41e7-bcb8-db3bc65194f2.aspxIbrahim

I have written a few posts recently describing out updated web publish experience.
These new experience is available for both Visual Studio 2010 as well as Visual Studio
2012 RC. You can use the links below to download these updates in the Azure SDK download.
Below are links for both versions.

Downloading the Visual Studio Web Publish Updateshttp://sedodream.com/PermaLink,guid,055c7ccf-e6a9-41e7-bcb8-db3bc65194f2.aspxhttp://sedodream.com/2012/06/15/DownloadingTheVisualStudioWebPublishUpdates.aspx
Fri, 15 Jun 2012 19:30:40 GMT<p>
I have written a few posts recently describing out updated web publish experience.
These new experience is available for both Visual Studio 2010 as well as Visual Studio
2012 RC. You can use the links below to download these updates in the Azure SDK download.
Below are links for both versions.
</p>
<ul>
<li>
<a href="http://go.microsoft.com/fwlink/?LinkID=254269&amp;clcid=0x409">Windows Azure
SDK for Visual Studio 2010</a>
</li>
<li>
<a href="http://go.microsoft.com/fwlink/?LinkId=254364&amp;clcid=0x409">Windows Azure
SDK for Visual Studio 2012 RC</a>
</li>
</ul>
<p>
The Web Publish experience is chained into VS 2012 RC so if you have installed VS
2012 RC with the Web features then you already have these features.
</p>
<p>
Thanks,
<br />
Sayed Ibrahim Hashimi <a href="https://twitter.com/#!/sayedihashimi">@SayedIHashimi</a>
</p>asp.netDeploymentVisual StudioVisual Studio 11Visual Studio 2010webWeb Deployment ToolWeb Publishing Pipelinehttp://sedodream.com/Trackback.aspx?guid=bfa8b339-0bf2-4d9c-995b-beaef0ce39bahttp://sedodream.com/pingback.aspxhttp://sedodream.com/PermaLink,guid,bfa8b339-0bf2-4d9c-995b-beaef0ce39ba.aspxIbrahim

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.

Publish profiles now a part of the project and stored in version control by default

Publish profiles are now MSBuild files

Profile specific web.config transforms

Overview

When you right click on your Web Application Project (WAP) you will now see the new
publish dialog.

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 Download publish profile link. After you import this publish
profile you will be brought to the Connection tab automatically.

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.

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.

Below that checkbox you will see a section for databases. The sample project shown
has an Entity
Framework Code First model, named ContactsContext, and it uses Code
First Migrations 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 my
previous blog entry for more info on that.

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 Execute Code Frist Migrations 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.

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.

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.

Publish Profiles

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
(for VB projects its My Project\PublishProfiles) and the extension is .pubxml.
You can see this in the image below.

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.

Visual Studio 2010 Web Publish Updateshttp://sedodream.com/PermaLink,guid,bfa8b339-0bf2-4d9c-995b-beaef0ce39ba.aspxhttp://sedodream.com/2012/06/15/VisualStudio2010WebPublishUpdates.aspx
Fri, 15 Jun 2012 19:07:30 GMT<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=&quot;pubdemo
- Web Deploy&quot;;Password={INSERT-PASSWORD}
</p>
<p>
&#160;
</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>asp.netMicrosoftMSDeployVisual Studio 2010webWeb Deployment ToolWeb Publishing Pipelinehttp://sedodream.com/Trackback.aspx?guid=2329c457-215a-4cab-949c-a4c614786128http://sedodream.com/pingback.aspxhttp://sedodream.com/PermaLink,guid,2329c457-215a-4cab-949c-a4c614786128.aspxIbrahim

We have two sets of ASP.NET providers which currently exist; the ASP.NET
SQL providers, and the ASP.NET
Universal Providers. In VS 2010 the SQL providers were in only providers used
for our project templates. In VS 2012 we have switched to using the Universal Providers.
One of the drawbacks of the SQL providers is that it leverages DB objects of SQL server
which are not available in SQL Azure.

In our updated web publish experience we have an Update Database checkbox which can
be used to incrementally publish the database to the destination database. In this
case if the source connection string is used by the ASP.NET SQL providers and you
are publishing to SQL Azure then you will see the following message on the dialog.

The publish dialog is letting you know that the SQL providers are not compatible with
SQL Azure and helps you convert to using the Universal Providers. After you install
the Universal Providers the web.config entry will be commented out and new entries
will be inserted for the Universal Providers. Your existing database will not be impacted,
we’ll create a new connection string pointing to a new database. If you had any data
in the SQL Providers database you will have to re-create those objects in the new
database.

If you have any questions please feel free to directly reach out to me at sayedha(at){MicrosoftDOTCom}.

ASP.NET providers and SQL Azurehttp://sedodream.com/PermaLink,guid,2329c457-215a-4cab-949c-a4c614786128.aspxhttp://sedodream.com/2012/06/07/ASPNETProvidersAndSQLAzure.aspx
Thu, 07 Jun 2012 22:41:46 GMT<p>
We have two sets of ASP.NET providers which currently exist; the <a href="http://msdn.microsoft.com/en-us/library/aa478948.aspx">ASP.NET
SQL providers</a>, and the <a href="http://www.hanselman.com/blog/IntroducingSystemWebProvidersASPNETUniversalProvidersForSessionMembershipRolesAndUserProfileOnSQLCompactAndSQLAzure.aspx">ASP.NET
Universal Providers</a>. In VS 2010 the SQL providers were in only providers used
for our project templates. In VS 2012 we have switched to using the Universal Providers.
One of the drawbacks of the SQL providers is that it leverages DB objects of SQL server
which are not available in SQL Azure.
</p>
<p>
In our updated web publish experience we have an Update Database checkbox which can
be used to incrementally publish the database to the destination database. In this
case if the source connection string is used by the ASP.NET SQL providers and you
are publishing to SQL Azure then you will see the following message on the dialog.
</p>
<p>
<a href="http://sedodream.com/content/binary/Windows-Live-Writer/7a4d3a6c7aa1_10431/SNAGHTML48cbb8.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="SNAGHTML48cbb8" border="0" alt="SNAGHTML48cbb8" src="http://sedodream.com/content/binary/Windows-Live-Writer/7a4d3a6c7aa1_10431/SNAGHTML48cbb8_thumb.png" width="724" height="564" /></a>
</p>
<p>
<em>Note: you may see the Update Database checkbox disabled, please visit </em><a href="http://sedodream.com/2012/06/07/VSPublishDialogUpdateDatabaseDialogDisabled.aspx"><em>http://sedodream.com/2012/06/07/VSPublishDialogUpdateDatabaseDialogDisabled.aspx</em></a><em> for
more info on why.</em>
</p>
<p>
The publish dialog is letting you know that the SQL providers are not compatible with
SQL Azure and helps you convert to using the Universal Providers. After you install
the Universal Providers the web.config entry will be commented out and new entries
will be inserted for the Universal Providers. Your existing database will not be impacted,
we’ll create a new connection string pointing to a new database. If you had any data
in the SQL Providers database you will have to re-create those objects in the new
database.
</p>
<p>
If you have any questions please feel free to directly reach out to me at sayedha(at){MicrosoftDOTCom}.
</p>
<p>
Sayed Ibrahim Hashimi <a href="https://twitter.com/#!/sayedihashimi">@SayedIHashimi</a>
</p>Visual StudioVisual Studio 11Visual Studio 2010webWeb Publishing Pipelinehttp://sedodream.com/Trackback.aspx?guid=44479d58-f995-4a20-9e1a-fd36971ad0f9http://sedodream.com/pingback.aspxhttp://sedodream.com/PermaLink,guid,44479d58-f995-4a20-9e1a-fd36971ad0f9.aspxIbrahim

If you have tried out our new Web Publish experience in Visual Studio you may have
noticed that the Update Database checkbox is disabled. See the image below.

The intended behavior of this checkbox is to enable you to incrementally publish your
database schema from the source (the connection string in web.config) to the destination
(whatever connection string is in the text box). The difference between an
incremental publish and a typical publish is that for incremental publishes only changes
are transferred from source to destination. With a full publish the first time that
you publish your DB schema everything is created, and the next time that you try to
publish you will receive an error because it tries to re-create existing DB objects.

The functionality of the Update database checkbox leverages an MSDeploy
provider. We were hoping to complete that provider and give it to hosters in time
for the release but we were unable to do so. We are working on completing the provider
and partnering with hosters to install these in time for the launch of Visual Studio
2012 RTM.

In the mean time if you need to publish your DB schema you can use the Package/Publish
SQL tab (caution: the DB publishing here is not incremental). If
you are going to use the PP/Sql tab to publish to SQL Azure then there are some special
consideraions that you will need to take. You can learn more about those by visiting http://msdn.microsoft.com/en-us/library/dd465343.aspx and
searching for “Azure” on that page.

If you have any questions please feel free to directly reach out to me at sayedha(at){MicrosoftDOTCom}.

VS Publish dialog Update Database dialog disabledhttp://sedodream.com/PermaLink,guid,44479d58-f995-4a20-9e1a-fd36971ad0f9.aspxhttp://sedodream.com/2012/06/07/VSPublishDialogUpdateDatabaseDialogDisabled.aspx
Thu, 07 Jun 2012 21:44:26 GMT<p>
If you have tried out our new Web Publish experience in Visual Studio you may have
noticed that the Update Database checkbox is disabled. See the image below.
</p>
<p>
<a href="http://sedodream.com/content/binary/Windows-Live-Writer/2be80936fb60_F50D/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/2be80936fb60_F50D/image_thumb.png" width="720" height="562" /></a>
</p>
<p>
The intended behavior of this checkbox is to enable you to <strong>incrementally publish</strong> your
database schema from the source (the connection string in web.config) to the destination
(<em>whatever connection string is in the text box</em>). The difference between an
incremental publish and a typical publish is that for incremental publishes only changes
are transferred from source to destination. With a full publish the first time that
you publish your DB schema everything is created, and the next time that you try to
publish you will receive an error because it tries to re-create existing DB objects.
</p>
<p>
The functionality of the <strong>Update database</strong> checkbox leverages an MSDeploy
provider. We were hoping to complete that provider and give it to hosters in time
for the release but we were unable to do so. We are working on completing the provider
and partnering with hosters to install these in time for the launch of Visual Studio
2012 RTM.
</p>
<p>
In the mean time if you need to publish your DB schema you can use the Package/Publish
SQL tab (<strong>caution: the DB publishing here is not incremental</strong>). If
you are going to use the PP/Sql tab to publish to SQL Azure then there are some special
consideraions that you will need to take. You can learn more about those by visiting <a title="http://msdn.microsoft.com/en-us/library/dd465343.aspx" href="http://msdn.microsoft.com/en-us/library/dd465343.aspx">http://msdn.microsoft.com/en-us/library/dd465343.aspx</a> and
searching for “Azure” on that page.
</p>
<p>
If you have any questions please feel free to directly reach out to me at sayedha(at){MicrosoftDOTCom}.
</p>
<p>
<br />
Thanks,
<br />
Sayed Ibrahim Hashimi <a href="https://twitter.com/#!/sayedihashimi">@SayedIHashimi</a>
</p>Visual StudioVisual Studio 11Visual Studio 2010webWeb DevelopmentWeb Publishing Pipelinehttp://sedodream.com/Trackback.aspx?guid=639ccf51-43f4-4638-be23-1201c654171ahttp://sedodream.com/pingback.aspxhttp://sedodream.com/PermaLink,guid,639ccf51-43f4-4638-be23-1201c654171a.aspxIbrahim

\I receive a lot of questions regarding web.config
transforms, which have existed in Visual Studio since 2010, and wanted to clear
up the support that we have in this area. These transforms show up in the solution
explorer underneath web.config as shown in the image below.

Since the names of these transforms include the build configuration many people expect
that web.config will be transformed when they start debugging (F5) or run the app
(CTRL+F5) in Visual Studio. But sadly this is not the case. These transforms
are kicked in only when the web is packaged or published. I totally agree
that this would be awesome, and I even blogged about how to enable it at http://sedodream.com/2010/10/21/ASPNETWebProjectsWebdebugconfigWebreleaseconfig.aspx.
It may seem like it would be really easy for us to include this support in the box,
but unfortunately that is not the case. The reason why we are not able to implement
this feature at this time is because a lot of our tooling (and many partners)
relies on web.config directly. For example when you drag and drop a database object
onto a web form, it will generate a connection string into the web.config. There are
a lot of features are like this. It is a significant investment for us to make a change
of this level. We were not able to get this done for Visual Studio 11, but it is on
our radar and we are looking to see what we can do in this area in the future.

web.config transforms, they are invoked on package and publish not F5http://sedodream.com/PermaLink,guid,639ccf51-43f4-4638-be23-1201c654171a.aspxhttp://sedodream.com/2012/05/12/webconfigTransformsTheyAreInvokedOnPackageAndPublishNotF5.aspx
Sat, 12 May 2012 02:29:15 GMT<p>
\I receive a lot of questions regarding <a href="http://msdn.microsoft.com/en-us/library/dd465326.aspx">web.config
transforms</a>, which have existed in Visual Studio since 2010, and wanted to clear
up the support that we have in this area. These transforms show up in the solution
explorer underneath web.config as shown in the image below.
</p>
<p>
<a href="http://sedodream.com/content/binary/Windows-Live-Writer/web.config-transforms_10FB5/image_2.png"><img title="image" 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="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/web.config-transforms_10FB5/image_thumb.png" width="291" height="329" /></a>
</p>
<p>
Since the names of these transforms include the build configuration many people expect
that web.config will be transformed when they start debugging (F5) or run the app
(CTRL+F5) in Visual Studio. But sadly this is not the case. <strong>These transforms
are kicked in only when the web is packaged or published</strong>. I totally agree
that this would be awesome, and I even blogged about how to enable it at <a href="http://sedodream.com/2010/10/21/ASPNETWebProjectsWebdebugconfigWebreleaseconfig.aspx">http://sedodream.com/2010/10/21/ASPNETWebProjectsWebdebugconfigWebreleaseconfig.aspx</a>.
It may seem like it would be really easy for us to include this support in the box,
but unfortunately that is not the case. The reason why we are not able to implement
this feature at this time is because a lot of our tooling (<em>and many partners</em>)
relies on web.config directly. For example when you drag and drop a database object
onto a web form, it will generate a connection string into the web.config. There are
a lot of features are like this. It is a significant investment for us to make a change
of this level. We were not able to get this done for Visual Studio 11, but it is on
our radar and we are looking to see what we can do in this area in the future.
</p>
<p>
Sayed Ibrahim Hashimi <a href="https://twitter.com/#!/sayedihashimi">@SayedIHashimi</a>
</p>Visual Studio 2010webhttp://sedodream.com/Trackback.aspx?guid=f623d885-ebb6-45c8-b0a3-f2d91e400d26http://sedodream.com/pingback.aspxhttp://sedodream.com/PermaLink,guid,f623d885-ebb6-45c8-b0a3-f2d91e400d26.aspxIbrahim

A couple months ago I blogged
about a Package-Web 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 (it captures all of your web.config transforms and has the
ability to transform on non-dev machines). Since that release I have updated
the project and tonight I created a video which shows the features a bit you can check
it out on Youtube. It’s embedded below.

Package web updated and video belowhttp://sedodream.com/PermaLink,guid,f623d885-ebb6-45c8-b0a3-f2d91e400d26.aspxhttp://sedodream.com/2012/03/14/PackageWebUpdatedAndVideoBelow.aspx
Wed, 14 Mar 2012 06:08:57 GMT<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>MSBuildMSDeployVisual StudiowebWeb Deployment ToolWeb DevelopmentWeb Publishing Pipelinehttp://sedodream.com/Trackback.aspx?guid=d9d1333e-0ff0-4fb4-b92a-72631e92442fhttp://sedodream.com/pingback.aspxhttp://sedodream.com/PermaLink,guid,d9d1333e-0ff0-4fb4-b92a-72631e92442f.aspxIbrahim

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:

Here you can see that I’m using the sync verb, along with a contentPath provider (which
points to a folder) as the source and the destination is using the package provider,
this point to where I want the package to be stored.

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.

The ClickOnce publish process is contained in the Microsoft.Common.targets file

The ClickOnce publish process is tied together through the Publish target

ClickOnce prepares the files to be published in a folder under bin named app.publish
which is governed by the MSBuild property PublishDir

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 </Project>).

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.

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 AfterTargets=”Publish” which means that it will be invoked
after the Publish target. It also declares DependsOnTargets=”Publish”.
Which means that whenever the target gets invoked that Publish will need to be executed
before CreateWebDeployPackage.

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 github
repository.

How to create a Web Deploy package when publishing a ClickOnce projecthttp://sedodream.com/PermaLink,guid,d9d1333e-0ff0-4fb4-b92a-72631e92442f.aspxhttp://sedodream.com/2012/02/18/HowToCreateAWebDeployPackageWhenPublishingAClickOnceProject.aspx
Sat, 18 Feb 2012 18:47:30 GMT<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=&quot;C:\Temp\_NET\WebPackageWithClickOnce\WebPackageWithClickOnce\bin\Debug\app.publish&quot;
-dest:package=&quot;C:\Temp\_NET\WebPackageWithClickOnce\WebPackageWithClickOnce\bin\Debug\co-pkg.zip&quot;</pre>
<p>
&#160;
</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=&quot; '$(WebDeployPackageName)'=='' &quot;&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=&quot;'$(MSDeployPath)'==''&quot;&gt;$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\3@InstallPath)&lt;/MSDeployPath&gt;
&lt;MSDeployPath Condition=&quot;'$(MSDeployPath)'==''&quot;&gt;$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\2@InstallPath)&lt;/MSDeployPath&gt;
&lt;MSDeployPath Condition=&quot;'$(MSDeployPath)'==''&quot;&gt;$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\1@InstallPath)&lt;/MSDeployPath&gt;
&lt;MSDeployExe Condition=&quot; '$(MSDeployExe)'=='' &quot;&gt;$(MSDeployPath)msdeploy.exe&lt;/MSDeployExe&gt;
&lt;/PropertyGroup&gt;
&lt;Target Name=&quot;CreateWebDeployPackage&quot; AfterTargets=&quot;Publish&quot; DependsOnTargets=&quot;Publish&quot;&gt;
&lt;!--
%msdeploy%
-verb:sync
-source:contentPath=&quot;C:\Temp\_NET\WebPackageWithClickOnce\WebPackageWithClickOnce\bin\Debug\app.publish&quot;
-dest:package=&quot;C:\Temp\_NET\WebPackageWithClickOnce\WebPackageWithClickOnce\bin\Debug\co-pkg.zip&quot;
--&gt;
&lt;PropertyGroup&gt;
&lt;Cmd&gt;&quot;$(MSDeployExe)&quot; -verb:sync -source:contentPath=&quot;$(MSBuildProjectDirectory)\$(PublishDir)&quot; -dest:package=&quot;$(OutDir)$(WebDeployPackageName)&quot;&lt;/Cmd&gt;
&lt;/PropertyGroup&gt;
&lt;Message Text=&quot;Creating web deploy package with command: $(Cmd)&quot; /&gt;
&lt;Exec Command=&quot;$(Cmd)&quot; /&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>ClickOnceIISMicrosoftMSBuildMSDeploywebhttp://sedodream.com/Trackback.aspx?guid=c3aa839b-d7dd-4847-b7ad-af347e1e86fchttp://sedodream.com/pingback.aspxhttp://sedodream.com/PermaLink,guid,c3aa839b-d7dd-4847-b7ad-af347e1e86fc.aspxIbrahim

The other day I saw a question posted on StackOverflow (link to question below
in resources section) 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 How
to take your web app offline during publishing 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.

You can use the contentPath
provider 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 UpdateWebCfg running in the Default Web
Site on my folder I would use the command shown below.

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 {SiteName}/{AppName}/{file-path}.
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.

You can view the latest sources for this sample at my github repo, link is below.

How to update a single file using Web Deploy (MSDeploy)http://sedodream.com/PermaLink,guid,c3aa839b-d7dd-4847-b7ad-af347e1e86fc.aspxhttp://sedodream.com/2012/02/14/HowToUpdateASingleFileUsingWebDeployMSDeploy.aspx
Tue, 14 Feb 2012 19:17:30 GMT<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=&quot;C:\Data\Personal\My Repo\sayed-samples\UpdateWebConfig\web.config&quot; -dest:contentPath=&quot;Default Web Site/UpdateWebCfg/web.config&quot;</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>
&#160;
</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>IISMSDeploywebWeb Publishing Pipelinehttp://sedodream.com/Trackback.aspx?guid=bc2ced18-9064-4f51-9167-05ec5595291chttp://sedodream.com/pingback.aspxhttp://sedodream.com/PermaLink,guid,bc2ced18-9064-4f51-9167-05ec5595291c.aspxIbrahim

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 .
If you want Web Deploy (aka MSDeploy) to natively support this feature please vote
on it at http://aspnet.uservoice.com/forums/41199-general/suggestions/2499911-take-my-site-app-offline-during-publishing.

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:

Publish app_offline.htm

Publish the app, and ensure that app_offline.htm is contained inside the payload being
published

Delete app_offline.htm

#1 will take the app offline before the publish process begins.
#2 will ensure that when we publish that app_offline.htm is not deleted (and therefore
keep the app offline)
#3 will delete the app_offline.htm and bring the site back online

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 static HTML (no
ASP.NET markup) 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.

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. Note: you can grab my latest version
of this file from my github repo, the link is in the resource section below.

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.

#2 Publish the app, and ensure that app_offline.htm is contained inside the payload
being published

This part is accomplished by the fragment

<!--***********************************************************************
Make sure app_offline-template.htm gets published as app_offline.htm
***************************************************************************-->
<!-- We need to create a replace rule for app_offline-template.htm->app_offline.htm for when the app get's published -->
<ItemGroup>
<!-- Make sure not to include this file if a package is being created, so condition this on publishing -->
<FilesForPackagingFromProject Include="app_offline-template.htm" Condition=" '$(DeployTarget)'=='MSDeployPublish' ">
<DestinationRelativePath>app_offline.htm</DestinationRelativePath>
</FilesForPackagingFromProject>
<!-- This will prevent app_offline-template.htm from being published -->
<MsDeploySkipRules Include="SkipAppOfflineTemplate">
<ObjectName>filePath</ObjectName>
<AbsolutePath>app_offline-template.htm</AbsolutePath>
</MsDeploySkipRules>
</ItemGroup>

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 (but it’s not the end
of the world if it does either).

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.

#3 Delete app_offline.htm

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:

This is implemented inside of the DeleteAppOffline target. This target will automatically
get executed after the publish because I have included the attribute AfterTargets=”MSDeployPublish”.
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.

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.

Resources

How to take your web app offline during publishinghttp://sedodream.com/PermaLink,guid,bc2ced18-9064-4f51-9167-05ec5595291c.aspxhttp://sedodream.com/2012/01/08/HowToTakeYourWebAppOfflineDuringPublishing.aspx
Sun, 08 Jan 2012 20:44:39 GMT<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&#160; 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=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;Project xmlns=&quot;http://schemas.microsoft.com/developer/msbuild/2003&quot;&gt;
&lt;Target Name=&quot;InitalizeAppOffline&quot;&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=&quot; '$(MSDeployExe)'=='' &quot;&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=&quot;C:\path\to\app_offline-template.htm&quot;
-dest:contentPath=&quot;Default Web Site/AppOfflineDemo/app_offline.htm&quot;
--&gt;
&lt;!--***********************************************************************
Make sure app_offline-template.htm gets published as app_offline.htm
***************************************************************************--&gt;
&lt;Target Name=&quot;PublishAppOfflineToDest&quot;
BeforeTargets=&quot;MSDeployPublish&quot;
DependsOnTargets=&quot;$(PublishAppOfflineToDest)&quot;&gt;
&lt;ItemGroup&gt;
&lt;_AoPubAppOfflineSourceProviderSetting Include=&quot;contentPath&quot;&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=&quot;contentPath&quot;&gt;
&lt;Path&gt;&quot;$(DeployIisAppPath)/app_offline.htm&quot;&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=&quot;$(_MSDeployVersionsToTry)&quot;
Verb=&quot;sync&quot;
Source=&quot;@(_AoPubAppOfflineSourceProviderSetting)&quot;
Destination=&quot;@(_AoPubAppOfflineDestProviderSetting)&quot;
EnableRule=&quot;DoNotDeleteRule&quot;
AllowUntrusted=&quot;$(AllowUntrustedCertificate)&quot;
RetryAttempts=&quot;$(RetryAttemptsForDeployment)&quot;
SimpleSetParameterItems=&quot;@(_AoArchivePublishSetParam)&quot;
ExePath=&quot;$(MSDeployPath)&quot; /&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=&quot;app_offline-template.htm&quot; Condition=&quot; '$(DeployTarget)'=='MSDeployPublish' &quot;&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=&quot;SkipAppOfflineTemplate&quot;&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=&quot;DeleteAppOffline&quot; AfterTargets=&quot;MSDeployPublish&quot;&gt;
&lt;!--
%msdeploy%
-verb:delete
-dest:contentPath=&quot;{IIS-Path}/app_offline.htm&quot;,computerName=&quot;...&quot;,username=&quot;...&quot;,password=&quot;...&quot;
--&gt;
&lt;Message Text=&quot;************************************************************************&quot; /&gt;
&lt;Message Text=&quot;Calling MSDeploy to delete the app_offline.htm file&quot; Importance=&quot;high&quot; /&gt;
&lt;Message Text=&quot;************************************************************************&quot; /&gt;
&lt;ItemGroup&gt;
&lt;_AoDeleteAppOfflineDestProviderSetting Include=&quot;contentPath&quot;&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;&quot;$(MSDeployExe)&quot; -verb:delete -dest:contentPath=&quot;%(_AoDeleteAppOfflineDestProviderSetting.Path)&quot;&lt;/_Cmd&gt;
&lt;_Cmd Condition=&quot; '%(_AoDeleteAppOfflineDestProviderSetting.ComputerName)' != '' &quot;&gt;$(_Cmd),computerName=&quot;%(_AoDeleteAppOfflineDestProviderSetting.ComputerName)&quot;&lt;/_Cmd&gt;
&lt;_Cmd Condition=&quot; '%(_AoDeleteAppOfflineDestProviderSetting.UserName)' != '' &quot;&gt;$(_Cmd),username=&quot;%(_AoDeleteAppOfflineDestProviderSetting.UserName)&quot;&lt;/_Cmd&gt;
&lt;_Cmd Condition=&quot; '%(_AoDeleteAppOfflineDestProviderSetting.Password)' != ''&quot;&gt;$(_Cmd),password=$(Password)&lt;/_Cmd&gt;
&lt;_Cmd Condition=&quot; '%(_AoDeleteAppOfflineDestProviderSetting.AuthType)' != ''&quot;&gt;$(_Cmd),authType=&quot;%(_AoDeleteAppOfflineDestProviderSetting.AuthType)&quot;&lt;/_Cmd&gt;
&lt;/PropertyGroup&gt;
&lt;Exec Command=&quot;$(_Cmd)&quot;/&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 />
&#160;&#160;&#160; -source:contentPath='C:\Data\Personal\My Repo\sayed-samples\AppOfflineDemo01\AppOfflineDemo01\app_offline-template.htm'
<br />
&#160;&#160;&#160; -dest:contentPath='&quot;Default Web Site/AppOfflineDemo/app_offline.htm&quot;',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=&quot;app_offline-template.htm&quot; Condition=&quot; '$(DeployTarget)'=='MSDeployPublish' &quot;&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=&quot;SkipAppOfflineTemplate&quot;&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 />
&#160;&#160;&#160;&#160;&#160; -verb:delete
<br />
&#160;&#160;&#160;&#160;&#160; -dest:contentPath=&quot;{IIS-Path}/app_offline.htm&quot;,computerName=&quot;...&quot;,username=&quot;...&quot;,password=&quot;...&quot;
<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>
&#160;
</p>
<p>
Sayed Ibrahim Hashimi <a href="https://twitter.com/#!/sayedihashimi">@SayedIHashimi</a>
</p>IISMicrosoftMSBuildMSDeployVisual Studio 2010webWeb Deployment ToolWeb Publishing Pipelinehttp://sedodream.com/Trackback.aspx?guid=7b98b9ee-5391-4ba5-9f64-bcbbe815035chttp://sedodream.com/pingback.aspxhttp://sedodream.com/PermaLink,guid,7b98b9ee-5391-4ba5-9f64-bcbbe815035c.aspxIbrahim

Note: I’d like to thank Tom Dykstra for helping me put this together

Overview

In this tutorial you'll see how to use a web deployment package package to
deploy an application. A deployment package is a .zip file that includes
all of the content and metadata that's required to deploy an application.

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 Web.config 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.

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.)

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 ASP.NET
Deployment Content Map on the MSDN web site.

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.

The hosting provider shown, Cytanium.com, is one of many that are available, and its
use here does not constitute an endorsement or recommendation.

Note 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 Web.config transformations for Web.config file changes
that depend on deployment destination. For information about how to use Web Deploy
parameters, see How
to: Use Parameters to Configure Deployment Settings When a Package is Installed.

Configuring the Deployment Package

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.

Open the Package/Publish Web tab of the Project Properties window
and select the Test build configuration.

For this deployment you aren't making any database changes, so clear Include
all databases configured in Package/Publish SQL tab. Make sure Exclude
files from the App_Data folder is selected.

By default, deployment packages are created as .zip files. You don't need
to change this setting.

By default, deployment packages are created in the project's obj\Test\Package folder.
You don't need to change this setting.

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.

For this tutorial you're not deploying IIS settings, so you don't need to enter a
password for that.

The Package/Publish Web tab now looks like this:

You also need to configure settings for deploying to the production environment. Select
the Release build configuration to do that.

Change IIS Web site/application name to use on the destination server 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.

Creating a Deployment Package for the Test Environment

To create a deployment package, first make sure you've selected the right build configuration.
In the Solution Configurations drop-down box, select Test.

In Solution Explorer, right-click the project that you want to build
the package for and then select Build Deployment Package.

The Output window reports successful a build and publish (package
creation) and tells you where the package was created.

Installing the Deployment Package in the Test Environment

The next step is to install the deployment package in IIS on your development computer.

Run IIS Manager. In the Connections pane of the IIS
Manager window, expand the local server node, expand the Sites node,
and select Default Web Site. Then in the Actions pane,
click Import Application. (If you don't see an Import Application link,
the most likely reason is that you have not installed Web Deploy. You can use the Web
Platform Installer to install both IIS and Web Deploy.)

In the Select the Package wizard step, navigate to the location of
the package you just created. By default, that's the obj\Test\Package folder
in your ContosoUniversity project folder. (A package created with the Release build
configuration would be in obj\Release\Package.)

Click Next. The Select the Contents of the Package step
is displayed.

Click Next.

The step that allows you to enter parameter values is displayed. The Application
Path value defaults to "ContosoUniversity", because that's what
you entered on the Package/Publish Web tab of the Project
Properties window.

Click Next.

The wizard asks if you want to delete files at the destination that aren't in the
source.

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 Next.

Installing IIS Manager for Remote Administration

The process for deploying to production is similar except that you create the package
using the Release build configuration, and you install it in IIS Manager using
a remote connection to the hosting provider. But first you have to install the IIS
Manager feature that facilitates remote connections.

Click the following link to use the Web Platform Installer for this task:

Connecting to Your Site at the Hosting Provider

After you install the IIS Manager for Remote Administration, run IIS
Manager. You see a new Start Page in IIS Manager that
has several Connect to ... links in a Connection tasks box.
(These options are also available from the File menu.)

In IIS Manager, click Connect to a site. In the Specify
Site Connection Details step, enter the Server name and Site
name values that are assigned to you by your provider, and then click Next.
For a hosting account at Cytanium.com, you get the server name from Service
URL 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.

In the Provide Credentials step, enter the user name and password
assigned by the provider, and then click Next:

You might see a Server Certificate Alert dialog box. If you're sure
that you've entered the correct server and site name, click Connect.

In the Specify a Connection Name step, click Finish.

After IIS Manager connects to the provider's server, a New
Feature Available dialog box might appear that lists administration features
available for download. Click Cancel — you've already installed everything
you need for this deployment.

After the New Feature Available box closes, the IIS Manager window
appears. There's now a node in the Connections pane for the site
at the hosting provider.

Creating a Package for the Production Site

The next step is to create a deployment package for the production environment. In
the Visual Studio Solution Configurations drop-down box, select the
Release build configuration.

In Solution Explorer, right-click the ContosoUniversity project
and then select Build Deployment Package.

The Output window reports a successful build and publish (package
creation), and it tells you that the package is created in the obj\Release\Package folder
in your project folder.

Installing the Package in the Production Environment

Now you can install the package in the production environment. In the IIS
ManagerConnections pane, select the new connection you
added earlier. Then click Import Application, which will walk you
through the same process you followed earlier when you deployed to the test environment.

In the Select the Package step, select the package that you just
created:

In the Select the Contents of the Package step, leave all the check
boxes selected and click Next:

Click Finish. Your application has been deployed to the hosting provider's
server, and you can test by browsing to your public site's URL.

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 ASP.NET
Deployment Content Map on the MSDN web site.

Using a Web Deploy package to deploy to IIS on the dev box and to a third party hosthttp://sedodream.com/PermaLink,guid,7b98b9ee-5391-4ba5-9f64-bcbbe815035c.aspxhttp://sedodream.com/2011/11/08/UsingAWebDeployPackageToDeployToIISOnTheDevBoxAndToAThirdPartyHost.aspx
Tue, 08 Nov 2011 05:11:43 GMT<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 &quot;_deploy&quot;
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: &quot;[clear this field]&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.
</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 &quot;ContosoUniversity&quot;, 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 &quot;Site/application&quot; 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>IISMSBuildMSDeploywebWeb Deployment ToolWeb DevelopmentWeb Publishing Pipelinehttp://sedodream.com/Trackback.aspx?guid=d158f2b8-cdee-4257-86cd-401362deeff2http://sedodream.com/pingback.aspxhttp://sedodream.com/PermaLink,guid,d158f2b8-cdee-4257-86cd-401362deeff2.aspxIbrahim

Back in November I participated in Virtual Tech
Days 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:

web.conig (XDT) transforms

How to publish to local file system using Visual Studio

How to publish to a 3rd party host using Visual Studio via MSDeploy

How to publish to local IIS server using the .cmd file generated by Visual Studio

How to use msdeploy.exe to delete IIS applications

How to use the IIS Manager to import web packages

How to use msdeploy.exe to deploy a web package to the local IIS server

How to use msdeploy.exe to deploy a web package to a remove IIS server

How to use msdeploy.exe to deploy a web package & set parameters using SetParameters.xml
to a remote IIS server

Video on Web Deployment using Visual Studio 2010 and MSDeployhttp://sedodream.com/PermaLink,guid,d158f2b8-cdee-4257-86cd-401362deeff2.aspxhttp://sedodream.com/2011/01/08/VideoOnWebDeploymentUsingVisualStudio2010AndMSDeploy.aspx
Sat, 08 Jan 2011 20:34:08 GMT
<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>Config-TransformationIISMSBuildMSDeployspeakingVisual StudioVisual Studio 2010webWeb Deployment ToolWeb DevelopmentWeb Publishing Pipelinehttp://sedodream.com/Trackback.aspx?guid=610e67fd-a3e6-41cd-bab4-1e462ae76e8bhttp://sedodream.com/pingback.aspxhttp://sedodream.com/PermaLink,guid,610e67fd-a3e6-41cd-bab4-1e462ae76e8b.aspxIbrahim

If you are doing any kind of web development and you are not familiar with the Web
Platform Installer(WPI) then you need to take a look at it. I just installed WordPress on
IIS 7 with just a few clicks and filled in a few text boxes. When you install WordPress there
are some prerequisites like mySql and php.
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, MSDeploy and dasBlog and
I didn’t have any issues what so ever.

When using the WPI there are two main categories that can be installed, Web Platform and Web
Applications. 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; DotNetNuke, nopCommerce,
and umbarco just to name a few. I’m not sure how
many apps are available but it looks like at least 50.

If you are an app creator and would like to share your app then you can visit the WPI
Developer page for a starting point.

Installing web apps made easy: Web Platform Installerhttp://sedodream.com/PermaLink,guid,610e67fd-a3e6-41cd-bab4-1e462ae76e8b.aspxhttp://sedodream.com/2010/06/07/InstallingWebAppsMadeEasyWebPlatformInstaller.aspx
Mon, 07 Jun 2010 03:17:01 GMT<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&#160; 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>DeploymentIISMSDeploywebWeb Platform Installer