I figured it out.
The problem is that the global.asax file is not part of the CMSApp project, so MSBuild/Publish ignores it. Global.asax(.cs) is part of the CMSApp_AppCode project, so the Global class gets compiled to this assembly, but without an actual Global.asax file at the web root directory, it never gets used.
The Global.asax.cs file loads up and ensures all "dynamic modules", and without it presumably all "custom classes" like the LicenseNewControlExtender are simply never registered.
Solution - There are two options, you only need one of them:
- Copy over the Global.asax file into your published web app directory as a post-deploy step. (No need to copy Global.asax.cs)
- Add Global.asax and Global.asax.cs to the CMSApp project and exclude them from the CMSApp_AppCode project
If you are using MSBuild to build and deploy a Kentico Web App, be warned. Serious pitfalls in the way. Basically any non-compiled asset that is referenced by the CMSApp_AppCode or CMSApp_MVC projects but not referenced by the CMSApp project will be omitted from your build output. That goes for the following, and probably other files I have yet to determine:
- Any .ashx files (including the vital \CMSPages\GetResource.ashx)
- Any .asmx files
- The aforementioned global.asax file
- Every View file you may have in your Views folder if you are using the MVC project