posted: September 14, 2009
If you're hosting a web application as a Web Role in an Azure Cloud Service Visual Studio project, then you will see some unusual behavior with the build output if you are performing builds on a TFS build server.
Normally, ASP.NET web applications are output to a folder named _PublishedWebsites on the build server after a successful build. However, if your Visual Studio solution is using an Azure Cloud Service project to host the web application as a web role, then you will find that the _PublishedWebsites folder does not exist in the build output folder on the TFS build server after a successful build.
Instead, the ASP.NET web application content is found within the Cloud Service output folder (it has a .csx suffix) on the build server:
Normal output without Cloud Service:
[out dir]\_PublishedWebsites\yourwebapp
With Cloud Service:
[out dir]\CloudService.csx\roles\yourwebapp\
If you would still like your web app content to be copied to _PublishedWebsites, simply create a 2nd Visual Studio solution that hosts your ASP.NET web application but do not add the Cloud Service project. Then create a new TFS Build that targets the new solution and it will be built without the Cloud Service - and your web application content will be copied as expected to the _PublishedWebsites folder.
You could also hack some MSBuild targets to prevent the _PublishedWebsites folder from being deleted. I personally prefer staying out of .target files, but there's no reason to not try that option as well.