My project is missing the web.config
file from the Views
folder. Here are the steps I took to make the project.
- Created an empty MVC project and installed the packages listed below.
- Created a controller and view. The view was created by right-clicking the action name and selecting 'Add View...' from the menu.
- Attempt to run the project, but got the error
CS0103: The name 'ViewBag' does not exist in the current context
I am getting this error because web.config
is missing from my Views
folder. Since the web.config
contains a lot of version numbers, tokens, etc..., my question is:
- Why wasn't this added when I installed the packages?
- Did the packages create a template I can use to make the
web.config
file?
Packages I installed:
Antlr 3.4.1.9004
bootstrap 3.3.4
jQuery 1.9.1
Microsoft.AspNet.Mvc 5.2.3
Microsoft.AspNet.Razor 3.2.3
Microsoft.AspNet.Web.Optimi... 1.1.3
Microsoft.AspNet.WebPages 3.2.3
Microsoft.Web.Infrastructure 1.0.0.0
Modernizr 2.6.2
Newtonsoft.Json 5.0.4
Ninject 3.2.2.0
Ninject.MVC5 3.2.1.0
Ninject.Web.Common 3.2.0.0
Ninject.Web.Common.WebHost 3.2.0.0
WebActivatorEx 2
WebGrease 1.5.2
Should prob look like this, as said in the comments it's part of the project template and not a package
UPDATE
The above is the default config file from the Views folder, it is added to a new Web Project when it's created using Visual Studio 2013. It uses