1

When I install package Microsoft.Web.Helpers I get next warning txt file (after installing): If the package is installed in an ASP.NET MVC 3 site, the site will not work. If you’ve already installed the package into an MVC 3 application, uninstall it. If the MVC 3 site does not work even after you have uninstalled the package, you might need to reinstall the ASP.NET MVC 3 packages as well. I can use Microsoft.Web.Helpers in controller class but cant in the view (@using Microsoft.Web.Helpers not found). I trying do next: Using ReCaptcha with MVC3 and razor? ReCaptcha and MVC3, problems getting Microsoft.Web.Helpers working .But it doesnt help.What I missed?

Community
  • 1
  • 1
Anton Putov
  • 1,951
  • 8
  • 34
  • 62

1 Answers1

3

You're missing the namespace in Views\Web.config (not the app root web.config).

<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
  <namespaces>
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Optimization"/>
    <add namespace="System.Web.Routing" />
  </namespaces>
</pages>

RickAndMSFT
  • 20,912
  • 8
  • 60
  • 78
  • by the irony of the case I had to reverse in the root register namespace.Thanks for idea,Rick.But then I have next eror while debug:Conflicting versions of ASP.NET Web Pages detected: specified version is "1.0.0.0", but the version in bin is "2.0.0.0". To continue, remove files from the application's bin directory or remove the version specification in web.config. -> I do both but still have problems. – Anton Putov Jul 08 '12 at 20:08
  • also I doing this:http://stackoverflow.com/questions/8215045/conflicting-versions-error-adding-asp-net-mvc-3-web-role-to-windows-azure-projec – Anton Putov Jul 08 '12 at 20:21