An error occurred during the compilation

I created a new Document Type called “News Page” and when I create a page called “Internal News” of type “News Page” I am getting the following error.

An error occurred during the compilation of a resource required to process this request. Please review the following specific error details and modify your source code appropriately.

One or more compilation references may be missing. If you’re seeing this in a published application, set ‘CopyRefAssembliesToPublishDirectory’ to true in your project file to ensure files in the refs directory are published.

The type or namespace name ‘NewsPage’ does not exist in the namespace ‘Umbraco.Cms.Web.Common.PublishedModels’ (are you missing an assembly reference?)
+
public class Views_NewsPage : Umbraco.Cms.Web.Common.Views.UmbracoViewPage<ContentModels.NewsPage>

When I looked at my models I see I have a file called NewsPage.generated.cs

Can anyone point me to what I am doing wrong?

If I go to the Template and updated

@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<ContentModels.NewsPage>

to

@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage

The page works… Can someone explain to me why?


This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/111713-an-error-occurred-during-the-compilation