[ Kentico 13 ] Why I Can't get the current page type, only the TreeNode?

Nikita Mikurov asked on October 21, 2020 07:37

Working in the new Kentika 13 in the latest beta version on .net Core.

Created a new page type of news page. I want to get a given NewsPage but only allows the TreeNode to be returned.

Image Text

Throws an error that NewsPage is not a TreeNode, although this cannot be...

Image Text

Help what's wrong?

Correct Answer

Jaroslav Kordula answered on October 21, 2020 08:51

Hi Nikita,

It seems to me that you forgot to use the AssemblyDiscoverable attribute in the project where you have the generated classes for your page types. Please see the docu page here. There is the Allowing discovery of the generated classes in custom assemblies section which describes the details. For the .NET core project, the AssemblyInfo is auto-generated, so you can either turn it off and handle it by yourself or modify the project file and add this:

  <AssemblyAttribute Include="CMS.AssemblyDiscoverableAttribute">

We use this custom attribute to optimize the discovery of custom implementations. Hopefully, this helps.



5 votesVote for this answer Unmark Correct answer

Recent Answers

Joe Rybacek answered on March 12, 2021 00:59

Thank you Jaroslav for the great advice! We store our generated classes in a project different than the main .NET Core MVC website. Adding the details you have above to our .csproj file where the generated classes are located did solve the issue.

0 votesVote for this answer Mark as a Correct answer

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