We are using Windows Azure to host our application on a Cloud Service and use Powershell to build and package the website using msbu
It's been a while since this question was posted and there is still no good answer. Recently I wanted to change the way MSBuild runs aspnet_compiler.exe but found no documentation. I did a bit of digging around and here is my experience.
Precompiling will only happen if you use both the DeployOnBuild and PrecompileBeforePublish parameters. Other usable parameters are EnableUpdateable and UseFixedNames.
msbuild Web.sln /p:DeployOnBuild=true /p:PrecompileBeforePublish=true /p:EnableUpdateable=false /p:UseFixedNames=true
You can achieve a similar result if you change precompile options in Visual Studio. This can be done at Project > Publish > Configure > Settings > File Publish Options > Precompile during publishing > Configure.
link to image
This is how the parameters should appear in your .pubxml file:
True
False
True
CreateSeparateAssembly
True
Since there is no documentation to be found you might want to change these options and see the resulting .pubxml file to see what further parameters to use in the command line.