1

I've got a python script that does everything I want with my web project after I publish it. Currently the way It works is that I use "Publish" on my web project to my local HD, then I manually run my .py and I get the outcome I want (minified, changed names, removed junk etc.). Afterwards, I upload the output to my shared hosting using FTP and I'm fine.

Now I'm moving to Windows Azure and I couldn't find a normal way to integrate the .py execution so it will create an "Azure Package" I can use on my cloud (or even a manual way to do it).

I'm really lost, It's not really post-build since it changes some code in the HTML and I don't want it to change the original HTML of the solution - only the published/packaged one.

pnuts
  • 58,317
  • 11
  • 87
  • 139
shaylevi2
  • 644
  • 1
  • 6
  • 14

1 Answers1

2

What I do for a similar situation, on post-build of each of my web projects, I run a script from the Post Build event for each project, that then copies all the files to a seperate deployment folder. (it deletes all the files there first if there is any and makes any changes such as cleaning up empty or useless directories)

Step1 - Create A Post Build Script

I did mine as a batch file but you could use anything.

In this script I have lines similar to

RMDIR "C:\Visual Studio 2010\Projects\Promotion\Deployment\FacebookApp" /S /Q
xcopy "C:\Visual Studio 2010\Projects\Promotion\FacebookApp" "C:\Visual Studio 2010\Projects\Promotion\Deployment\FacebookApp\" /s /e
RMDIR "C:\Visual Studio 2010\Projects\Promotion\Deployment\FacebookApp\obj" /S /Q
RMDIR "C:\Visual Studio 2010\Projects\Promotion\Deployment\FacebookApp\Styles" /S /Q

Add the script to your Post-Build Event

PostBuildEvent

Step 2 - Change Azure Project to point to new folders

Then I setup my Azure project to point to the deployment folder with the projects in it, instead of directly to the development ones.

ServiceDefinition

In the ServiceDefinition.csdef here is my example

<Site name="FacebookApp" physicalDirectory="..\Deployment\FacebookApp">
    <Bindings>
      <Binding name="Endpoint1" endpointName="Endpoint1" hostHeader="sub.domain.com" />
      <Binding name="Endpoint2" endpointName="Endpoint2" hostHeader="sub.domain.com" />
    </Bindings>
</Site>

(Just in case you are wondering Endpoint1 is Port 80 regular http and Endpoint2 is Port 443 https)

All I do now is rebuild my project, then hit publish on the Azure project and its all done. After waiting 30 minutes for it to deploy and update :)

Adam
  • 16,089
  • 6
  • 66
  • 109
  • Adam I would appreciate it if you could attach a guide (some photos) to what you wrote, no offense, but I didn't get anything. – shaylevi2 Apr 07 '12 at 16:14
  • I'd recommend using [`AfterBuild`](http://stackoverflow.com/q/6128567/147211) target instead of an unmanaged Post Build Event – KMoraz Apr 08 '12 at 16:09
  • @KMoraz - Afterbuild runs regardless of whether the build was successful or not, so in this case I think PostBuild would be more suited. – Adam Apr 09 '12 at 03:28