Azure Project build package working from VS, failing from command line with error MSB4096 Azure Project build package working from VS, failing from command line with error MSB4096 azure azure

Azure Project build package working from VS, failing from command line with error MSB4096


I found this link: Visual Studio 2010 Beta 2 myTODO Error message it works for me. The valuable information from that link:

It seems like maybe Azure does not like it if you specify anything besides an Azure Role project as a dependency on the service project. I made it so MyWebRole.csproj was dependent on xxx.csproj, instead of MyService.ccproj being dependent on xxx.csproj, and it worked.


I stumbled upon a similar problem when building my cloud project from the command line, in particular I get this exception if the web project referenced by the VirtualDirectory tag is marked as a build dependency for the cloud project.

To avoid this and ensure that the web project is compiled and included in the cspack, I come up with a procedure simpler that the one cited in Swell's answer -- in particular it does not require to alter the project files but only to call two targets in a precise order:

  1. ensure in Configuration Manager that the web project will be rebuilt in the desired solution configuration (for example ensure that it is built under Release configuration);
  2. ensure that the web project is not a build dependency of the cloud project;
  3. do a rebuild of the solution, for example

    MsBuild solution.sln /t:Rebuild ...

    This way the web project will be recompiled.

  4. perform a publish of the cloud project, for example

    MsBuild solution.sln /t:cloudproject.ccproj:publish ...

    The web project will be copied correctly to the cspack file.