Ceshion
Ceshion

Reputation: 706

missing compilation references in Razor pages after adding model

I am creating a .NET Core web app using framework 4.6.2. I built my first view, testing throughout, until I added my view model and the page now errors out whenever I navigate to it. The errors are shown below. The ViewModel has all of the referenced properties on it. I don't even have a project.json given it's a brand new project on VS17.

screenshot showing referenced errors including Type Expected, type or namespace TModel could not be found, and several instances of "View Model does not contain a definition for property"

Upvotes: 0

Views: 580

Answers (1)

Ceshion
Ceshion

Reputation: 706

This will happen if the properties you're using on your view model are not marked public. In my case, I had them marked internal and so was getting this error.

Upvotes: 0

Related Questions