Kentico 8 Admin error: [ClassHelper.GetClass]: Custom class 'LicenseNewControlExtender' was not foun

Kurt Schindler asked on July 1, 2014 13:33

I've installed a new Kentico 8 Web Application Project, and w/ IIS configured to run the website out of the CMS directory, everything works.

But when I publish the application via Visual Studio CMSApp > right+click > Publish (or by compiling the app at the command line via MSBuild) and then have IIS point to the published website directory, I get the following error when attempting to access the License page in the Admin portal:

[Error loading the WebPart '' of type '(unknown)'] 
[ClassHelper.GetClass]: Custom class 'LicenseNewControlExtender' was not found. Please make sure you register it properly using RegisterCustomClass attribute, or that you provide it through OnGetCustomClass event.

I have verified that the CMSApp_OldAppCode project was compiled and referenced by CMSApp and that LicenseNewControlExtender exists in CMSAppAppCode.dll.

Any help?

Recent Answers

Derick Viarrial answered on July 1, 2014 19:20

We're seeing that exact same issue today coincidentally...

1 votesVote for this answer Mark as a Correct answer

Kurt Schindler answered on July 2, 2014 09:44

At the time I wrote this, I did not know about this additional tweak required of the CMSApp.csproj file... but unfortunately, it doesn't resolve the issue.

I've run into a number of issues with MSBuild and Kentico's structure for Web App projects, but all of them except for this one have been obvious and easy to troubleshoot.

Can any Kentico folks shed some light on what this code is trying to do, and why this error might occur? As mentioned, I am certain that the LicenseNewControlExtender class exists (in the CMSAppAppCode.dll assembly, which is in the bin) so I have no idea how to troubleshoot further.

Again, I don't have a problem if the IIS site is pointing at the \CMS source code directory. Its only when I build the project with MSBuild and deploy to an external location that this issue occurs.

1 votesVote for this answer Mark as a Correct answer

Kurt Schindler answered on July 2, 2014 11:42

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:

  1. Copy over the Global.asax file into your published web app directory as a post-deploy step. (No need to copy Global.asax.cs)
  2. 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
4 votesVote for this answer Mark as a Correct answer

Craig Gamble answered on December 16, 2014 13:17

just to add to this thread which was a great help.

regarding the missing asax & ashx files on publish. you need to publish both (or 3 if using MVC) projects into the same publish directory.

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.