RobH
RobH

Reputation: 3612

Multiple Azure projects for one MVC app

I have a situation where I need multiple .cscfg and .csdef files - i.e. I'm deploying to multiple Azure subscriptions and each one needs different endpoints and certificates etc.

I've looked into using XDT transforms to change the .csdef file on build to swap the certificates etc. but I'm not 100% happy with doing this as it seems like the scope for error is pretty high... As well as potentially having many different configurations.

Is it possible to have multiple Azure Cloud service projects in the same solution for a single web app? If I just try to add a new one in, VS creates a new MVC app for it and there doesn't seem to be any way of changing which project the web role uses.

Or is there a better way of changing things like certificates for publishing web roles to Azure?

Upvotes: 1

Views: 197

Answers (1)

mcollier
mcollier

Reputation: 3719

You can certainly have multiple .cscfg files in a single Windows Azure deployment project. Visual Studio already creates a [your-project-name].Local.cscfg and [your-project-name].Cloud.cscfg for Windows Azure projects. There's nothing stopping you from create a [your-project-name].Foo.cscfg configuration either.

The problem (as I'm sure you're noticing) becomes the .csdef. Only one of those in a deployment project. The transform approach is one solution. Another option I've used in the past is to create multiple Windows Azure deployment projects in the solution - one project per configuration / target environment. Each project is then mapped to the same MVC project. This keeps the Visual Studio tooling working like it expects to work. The downside is that you have more configuration to manage (i.e. have to keep all the .cscfg and .csdef files in each project in sync). Works, but kind of painful.

Upvotes: 2

Related Questions