Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HtmlHelper does not contain a definition for Bootstrap #441

Open
gwaz opened this issue Nov 23, 2016 · 2 comments
Open

HtmlHelper does not contain a definition for Bootstrap #441

gwaz opened this issue Nov 23, 2016 · 2 comments

Comments

@gwaz
Copy link

gwaz commented Nov 23, 2016

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
Copy link
Owner

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
Copy link
Author

gwaz commented Nov 23, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants