Posted by & filed under programming, Technology.

When you’re putting a Kentico CMS site together, and you’re deploying to Azure, the one thing that doesn’t work too well is the emulator. It works, it’s just really intensive and slow-going. Especially if you want to run through small features or logic and need to do relatively frequent (and normal) build updates.

Enter build configurations and preprocessors. Under the hood, a KCMS web app for Azure is not that much different to a regular web application, with the exception of the AzureInit class. For local testing and running my app as a regular web application, I simply created a new build configuration (copied from the default ‘Debug’) calling it ‘Local’. In the other configurations, I added an extra pre-processor definition “FOR_AZURE” and then in the AzureInit class (in the web app project), I added:


public void ApplicationStartInit()
{
#if FOR_AZURE
AzureHelper.OnGetApplicationSettings += AzureHelper_GetApplicationSettings;
...
#endif
}

That way, when I’m building for local testing, I skip all the Azure goodness, and then if I need to package and deploy, let the project settings take over. Sure, there some specific things that you won’t be able to work through- but you can still get a near-perfect resemblance on a straightforward deploy.

One Response to “Building Kentico CMS for Azure”

Leave a Reply

  • (will not be published)