6

So I have the following requirements: 1. Compile a large MVC app and pre-compile all of its views. 2. Run transforms for web.config 3. Package and publish for deployment into Azure Web Role

I can do 1 with a modified proj file, 2 works if I us msdeploy, and 3 works fine when I use the VS 2012 Azure tools. Now I want to put these all together into a scripted process.

Has anyone already done the leg work to get this running?

Todd Carter
  • 879
  • 7
  • 20
  • You can add #1 to #2 by passing in `/p:PrecompileBeforePublish=true` at the command line rather than the MvcViews-sounding property – Richard Szalay Mar 11 '13 at 11:38
  • Richard - thanks, yea and I can check the pre-compile checkbox in the UI. I believe the challenge here is the fact I am trying to combine the publishing of a web role with some of the publishing features of webdeploy and they appear to be different beasts. I know I can publish a web role and then webdeploy to it but that only works if you have 1 instance of the web role. – Todd Carter Mar 11 '13 at 13:13

1 Answers1

6

1)

/p:PrecompileBeforePublish=true

2 + 3)

You need to add the following MSBuild target in your .ccproj to copy in your transformed Web.config file (using Web.Release.config as your target for transforms):

<Target Name="CopySpecialFilesIntoPackage" AfterTargets="CopyWorkerRoleFiles">
  <ProjectName>WebProjectName</ProjectName>
  <TransformXml Source="$(ProjectDir)..\$(ProjectName)\Web.config" Transform="$(ProjectDir)..\$(ProjectName)\Web.Release.config" Destination="$(ProjectDir)obj\$(Configuration)\$(ProjectName)\$(ProjectOutput).config" />
</Target>

If you want to web deploy to multiple instances of a web role, you can use Azure Web Sites or the open source project Azure Web Farm for when you need a web role (eg SSL on custom domains).

Matt Davies
  • 1,259
  • 10
  • 10