Sponsors

News

Laurent Kempé MVP JetBrains Academy Member Certified ScrumMaster

Contact

My status

View Laurent Kempé's profile on LinkedIn
XING
twitter
facebook


Xbox 360



Map

Locations of visitors to this page

.NET Dudes

Family

French .NET Dudes

Friends

Links

Tech Head Brothers

Web Deployment Projects for VS08 released as CTP & Migration tips

My old build script wasn't working after the migration to this new version and you will find in this post the different adaptation that I had to do.

Add missing ToolsVersion as following:

<Project DefaultTargets="Build" 
         xmlns="http://schemas.microsoft.com/developer/msbuild/2003" 
         ToolsVersion="3.5">
Replace
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WebDeployment\v8.0\Microsoft.WebDeployment.targets"/>

with

<Import Project="$(MSBuildExtensionsPath)\Microsoft\WebDeployment\v9.0\Microsoft.WebDeployment.targets"/>

I also had to add the following to the beginning of my AfterBuild task:

<Target Name="AfterBuild">
  <CreateItem Include="$(TempBuildDir)\**\*.*">
    <Output ItemName="CompiledFiles" TaskParameter="Include" />     
  </CreateItem>
  <Exec Command="if exist &quot;$(WDTargetDir)&quot; rd /s /q &quot;$(WDTargetDir)&quot;" />
  <Exec Command="if not exist &quot;$(WDTargetDir)&quot; md &quot;$(WDTargetDir)&quot;" />
  <Copy SourceFiles="@(CompiledFiles)" DestinationFolder="$(WDTargetDir)\%(CompiledFiles.SubFolder)%(CompiledFiles.RecursiveDir)" />
  <Exec Command="if exist &quot;$(TempBuildDir)&quot; rd /s /q &quot;$(TempBuildDir)&quot;" />
  ...
</Target>

Otherwise I ended up with TempBuildDir folder with a part of my solution. This is just a copy of what is defined in Microsoft.WebDeployment.targets.

Now everything works like before, I can:

  1. set Staging as my active solution configuration
  2. Run a compilation
  3. Zip the merged result of the build
  4. Start uploading using ssh to the target stage server

Nice!

Comments

BottleIT said:

Web deployment project CTP for VS2008 - missing connectionStrings element

# December 14, 2007 9:54 PM

Tom Bull said:

Thanks for blogging about this... it really helped.

For your deployment, why not write a batch file that does the zip and automatically uploads the build to the test server? Even better, why not have something like CruiseControl or the new CI stuff in TFS execute that batch file for you as part of the build process? Even better still, why not have the batch file kick off the process on the staging server to have the build deployed using something like psexec?

One click build and deploy is really satisfying and really easy to achieve. And its reliable. And you can use it for live servers too.

# January 15, 2008 12:17 PM

lkempe said:

Tom: You are welcomed! I don't have the infrastructure at home to have CruiseControl installed. I use mainly this to deploy my web site Tech Head Brothers (www.techheadbrothers.com). But at Work I am using CruiseControl, but not till deployment but it is something I am looking for in a near future ;)

# January 15, 2008 3:35 PM

Harish said:

Works great , i spent quite sometime figuring out why the AfterBuild event does not copy the compiled output to the target directory(Debug/Release) and leaves it in the TempBuildDir.

Thanks Much !

# July 16, 2008 2:50 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)