Tuesday, February 26, 2008

Automating your Deployment

Check out this wicked NAnt target for clickOnce deployment. MageFileUpdater is a command line tool that I created for updating various parts of the deployment manifest and application manifest files. MageFileUpdater makes up for Mage.exe weak command line support. Mage via command line does not allow you to add an icon in the windows start menu or update the publisher name and product name. According to MSDN documentation the new version of mage packaged with visual studio 2008 allows you to update the publisher name. Even though that's kind of cool they are still missing a multitude of features.

In addition to this neat little target I am working on leveraging msbuild(exe) from nant to execute a msbuild file to create the boot strap that will install prerequisites for a clickOnce application.

The good thing about automating your deployment is that you only have to do it once. Hopefully in the near future I can throw together a few more posts about how we automated our deployment with NAnt and the many hurdles we had to jump. 

<target name="create.clickonce">   

    <call target="create.clickonce.dir" />

    <!--  Generates the application manifest file. -->

    <exec program="${dotnet.sdk.dir}\mage.exe" commandline="${mage.console.args.new.application}" verbose="true" />

    <!--  updates the application manifest file with the icon to be displayed in the start menu. -->

    <exec program="${tools.dir}\mageUpdater\MageFileUpdater.exe" commandline="${mageFileUpdaterConsoleArgumentsForApplication}"/>

    <!--  signs the  application manifest file -->

    <exec program="${dotnet.sdk.dir}\mage.exe" commandline="${mage.console.args.sign.application}" verbose="true" />


    <!--  Creates deployment manifest file -->

    <exec program="${dotnet.sdk.dir}\mage.exe" commandline="${mage.console.args.new.deployment}" verbose="true" />

    <!--  Updates the deployment manifest file with an association to the application manifest file. -->

    <exec program="${dotnet.sdk.dir}\mage.exe" commandline="${mage.console.args.update.deployment}" verbose="true" />

    <!-- Changes the deployment type in the deployment manifest. -->

    <exec program="${tools.dir}\click.once\click.once.console.exe" commandline="${clickonce.dir}\${app.exe}.application" verbose="true" />

    <!--  Updates the name of the publisher and product name. -->

    <exec program="${tools.dir}\mageUpdater\MageFileUpdater.exe" commandline="${mageFileUpdaterConsoleArgumentsForDeployment}"/> 

    <!-- Lastly deployment manifest file is signed -->

    <exec program="${dotnet.sdk.dir}\mage.exe" commandline="${mage.console.args.sign.deployment}" verbose="true" />



Stewart Johnson said...

can you share the exe that you created with the rest of us?

marko said...

In any case, hold up you say. I don't have much cash! Hell, on the off chance that I was purchasing a business for $500,000.00 then as opposed to coming up with $100,000.00 (20%) now I need to think of $200,000.00 to $250,000.00. cash advance corona