DmitryEfimenko / TwitterBootstrapMvc

Fluent implementation of ASP.NET-MVC HTML helpers for Twitter Bootstrap.
Apache License 2.0
224 stars 79 forks source link

HtmlHelper does not contain a definition for Bootstrap #441

Open gwaz opened 7 years ago

gwaz commented 7 years ago

I have an existing WebApi2 + MVC solution to which I have installed TwitterBootstrapMVC5 following the instructions and added my license file.

Razor does not detect Bootstrap: 'HtmlHelper' does not contain a definition for 'Bootstrap' and no extension method 'Bootstrap' accepting a first argument of type 'HtmlHelper' could be found (are you missing a using directive or an assembly reference?)

I've ensured Bootstrap.Configure() is executed. At runtime I get:

Compiler Error Message: CS1963: An expression tree may not contain a dynamic operation

for

Line 10:     @(Html.Bootstrap().LabelFor(m => m.UserName)
Line 11:     .LabelText("Username")
Line 12:     .ShowRequiredStar(true))

TwitterBootstrapMVC5 and T4MCXExtensions are referenced. I've tried to restart Visual Studio but nothing helps.

DmitryEfimenko commented 7 years ago

I know you said you followed instructions, but this one is a very common and easy to make mistake: the web.config file, where you are instructed to add two namespaces is located under Views folder, not under the project root. Are you sure you modified the correct file?

If so, I'd have to ask you to send me a simple project example showing the issue.

gwaz commented 7 years ago

Thank you very much for the reply. The changes are made in the web.config in Views folder. Currently I am investigating some issues to make sure that it is in fact a TwitterBootstrap issue and not VS2015. I will write again when I know more.