Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Sir,

I add a .dll to a project and for using it in my view i add a namespace in web.Config(in view folder) but after adding namespace i am getting an error in all my .cshtml files in
@model line.

what is wrong..
my login.cshtml

@model myStore.Models.LoginModel
@using myStore
@using myStore.Models

@using mynamespace


i changed add this to add namespace in web.config.

XML
<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" />
         <add namespace="mynamespace" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>




thanks in advance.
Posted
Updated 10-Oct-14 8:41am
v2
Comments
ZurdoDev 10-Oct-14 14:28pm    
Instead of us guessing the error, I suggest you click on Improve question and provide that.
TNJS82 10-Oct-14 14:43pm    
sir is it ok now..?
i m not getting any error before this . I rebuild..restarted the project it will still not resolving the error.
ZurdoDev 10-Oct-14 14:47pm    
What is the error?
TNJS82 10-Oct-14 14:50pm    
the 'model' does not exists in the current context
ZurdoDev 10-Oct-14 14:52pm    
So whatever namespace you added is conflicting or messing something up.

1 solution

Please check here[^]
Please check the solution in the above link, This may help.
If not, respond back with comments.
All the best.
Thanks
:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900