joym8
joym8

Reputation: 4232

Not able to compile solution after adding new fields to Kentico Page Type

We're using Kentico 11.0.26 with MVC.

We have a page type called Header. It has several custom fields and everything has been pulling over on MVC side just fine. Today I needed to add couple of new fields. After adding the fields, I copied the generated code for Header.cs and HeaderProvider.cs into MVC solution in Visual Studio.

The solution won't compile now.

The 2 new fields are available in the Header.Fields property, but 4 old fields are not available. Remaining old fields are available.

HeaderLogo is one of those 4 fields that are no longer available in Intellisense:

On this line: string HeaderLogo = header.Fields.HeaderLogo; I get the following compiler error:

Header.HeaderFields' does not contain a definition for 'HeaderLogo' and no extension method 'HeaderLogo' accepting a first argument of type 'Header.HeaderFields' could be found (are you missing a using directive or an assembly reference?)

Header.cs does have the definition for HeaderLogo as well as all other fields.

Upvotes: 0

Views: 72

Answers (1)

Roman Hutnyk
Roman Hutnyk

Reputation: 1549

I'd recommend you to roll back Header.cs and HeaderProvider.cs files and paste only new code from auto-generated by Kentico Info and InfoProvider files. In other words do not replace files, but merge changes.

Looks like you've removed some fields by replacing the file. The question is why Kentico does not include old fields? - Is your database up to date?

Upvotes: 0

Related Questions