Error after creating view in ASP.NET
I'm branching out into doing some web development, which is fairly new to me. I've picked up a book to help me along the way, and it's been going well so far until this chapter working with MVC. Working with the MVC was going fine until I created a view, then I get errors everywhere.
I started by creating the model which was nothing special. It contained a default constructor with a List initialized, and the class also defined some new properties:
public UserDemographics(){ Hobbies = new List<String>(); } public string Gender{ get; set; } ....
Everything was going fine here, whatever. Then moved onto creating the controller. Once the controller was created, nothing was changed in the code. Still everything was ok.
Then moved onto creating the view, and everything went bad. Created the view referencing the proper model, and just about every line has an error.
.... <th> @Html.DisplayNameFor(model => model.Gender) </th> ....
I highlight over the @Html.DisplayNameFor and it says:
The type 'Expression<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Core, Version=4.0.0.0, Cultrue=neutral, PublicKeyToken=b77a5c561934e089'
Why would this be happening?
Edit: Nevermind. After doing a little more researching, I found that it's an issue with the NuGet Version that is installed, so it needs to be downgraded through the package manager.
0 comments:
Post a Comment