在view / webconfig中添加命名空间后,在@model行中出错 [英] Getting error in @model line after adding a namespace in view/webconfig
问题描述
先生,
我在项目中添加了一个.dll,并在我的视图中使用它,我在web.Config中添加一个命名空间(在视图文件夹中)但是在添加命名空间后,我在
@model行中的所有.cshtml文件中出现错误。
出了什么问题..
我的login.cshtml
@model myStore.Models.LoginModel
@using myStore
@using myStore.Models
@using mynamespace
i更改添加此项以在web.config中添加命名空间。
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.
<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.
推荐答案
请在这里查看 [ ^ ]
请查看以上链接中的解决方案,这可能有所帮助。
如果没有,请回复评论。
一切顺利。
谢谢
:)
Please check here[^]
Please check the solution in the above link, This may help.
If not, respond back with comments.
All the best.
Thanks
:)
这篇关于在view / webconfig中添加命名空间后,在@model行中出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!