Search code examples
azureazure-web-rolespaas

Shared codebase Azure cloud service


we want to deploy a webrole on the Azure cloud service (PaaS) we have multiple Virtual Applications that have exactly the same codebase (dlls) but different web.configs

this leads to multiple time the same dll's in the package to upload; resulting in a very large package file

is there any way to share the bin folder for these 'same' Virtual Applications to minimize the size of the package?

greetings, Tim


Solution

    1. Create a cloud application with one web role containing the codebase and additional web roles containing only the Web.config for the multiple virtual applications.
    2. On ServiceDefinition.csdef, define the virtual applications for the roles as required.
    3. Set a startup task to copy the contents from the complete web role to each of the additional virtual applications. This will be executed at role initialization time, with administrator privileges.

    This way your deployment package won't need to include multiple copies of the same artifacts, and the virtual applications will be set up when the role instance is initialized.