My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
MSBuild  
MS Build Stuff
MSBuild, WebApplicationProjectPublish, VisualStudio
Updated Jul 19, 2009 by antixsof...@gmail.com

Web Application Publish

  • Retrieves a BuildVersion from AssemblyInfo file
  • Publishes the application to a staging folder
  • Checks for Web_Publish.config
  • Compresses js and .css files found in the application
  • FTPs changed files the application

Prerequisites

This file should be placed in "Antix" under the MSBuild Extensions path
MSBuild Community Tasks 1.3 or above http://msbuildtasks.tigris.org/
Java Runtime http://www.java.com/en/download/index.jsp
YUI Compressor http://developer.yahoo.com/yui/compressor/

usually "C:\Program Files\MSBuild" along with the YUICompressor

so...

  • C:\Program Files\MSBuild\Antix\Antix.WebApplication.Publish.targets
  • C:\Program Files\MSBuild\Antix\yuicompressor.jar

you don't have to, if you don't, make sure you alter the script for the new locations

Usage

Copy the following to you project file and fill in the properties (example PublishPath and PublishFTPRoot)

  <Import Project="$(MSBuildExtensionsPath)\Antix\Antix.WebApplication.Publish.targets" />
  <Target Name="AfterBuild">
    <PropertyGroup>
      <PublishPath>P:\$(MSBuildProjectName)\$(BuildVersion)</PublishPath>
      <PublishFtpHost>127.0.0.1</PublishFtpHost>
      <PublishFtpRoot>$(MSBuildProjectName)/$(BuildVersion)</PublishFtpRoot>
      <PublishFtpUser></PublishFtpUser>
      <PublishFtpPassword></PublishFtpPassword>
    </PropertyGroup>
    <MSBuild Projects="$(MSBuildProjectFile)" Targets="Publish" 
      Properties="PublishPath=$(PublishPath);PublishFtpHost=$(PublishFtpHost);PublishFtpRoot=$(PublishFtpRoot);PublishFtpUser=$(PublishFtpUser);PublishFtpPassword=$(PublishFtpPassword);" />
  </Target>

to do this ...

  1. Right click the web application project and select "Unload Project"
  2. Right click the now "(unavailable)" web application project and select "Edit 'Project Name'"
  3. Scroll down the project and place the copied code above under the existing imports (see below)
  4. Right click the "(unavailable)" web application project and select "Reload Project"
  5. Create a new Configuration in the configuration manager called "Publish"
  6. Making sure "Publish" is selected in your configuration manager, build your project

existing imports look like this;

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />

From then on all you need to is step 6. and edit the version.txt file to set the version required


Sign in to add a comment
Powered by Google Project Hosting