Shaun Luttin
Shaun Luttin

Reputation: 141462

ViewBag: One or more types required to compile a dynamic expression cannot be found

One or more types required to compile a dynamic expression cannot be found. Are you missing a reference?

ViewBag.SomeKey = "Some Value";

Upvotes: 0

Views: 1384

Answers (2)

Zealous System
Zealous System

Reputation: 2324

This is because you are missing a reference to Microsoft.CSharp. To add this reference, on your solution explorer window, right click to References, select Add Reference, go to .NET tab, find and add Microsoft.CSharp.

This will solve your problem.

Upvotes: 4

Shaun Luttin
Shaun Luttin

Reputation: 141462

Add a reference to Microsoft.CSharp.

  1. Solution Explorer
  2. References
  3. Right Click > Add Reference

Add Reference to Microsoft.CSharp

Upvotes: 1

Related Questions