在已部署的 MVC3 应用程序中找不到 Telerik 命名空间
我刚刚部署了一个新的 MVC3 应用程序,经过我的托管提供商方面的一些努力,MVC3 似乎运行正常,但现在在加载网站上的任何内容之前我收到以下编译错误:
CS0246:类型或命名空间无法找到名称“Telerik”(您是否缺少 using 指令或程序集引用?)
这发生在 web.config 的以下行中:
<add namespace="Telerik.Web.Mvc.UI" />
我知道 DLL 存在于主机上的 bin 文件夹中,所以我是有点迷失,不知道还有什么可能是错的。
I have just deployed a new MVC3 application, and after some efforts on my hosting provider's side, MVC3 seems to be running OK, but now I get the following compilation error before anything on the site loads:
CS0246: The type or namespace name 'Telerik' could not be found (are you missing a using directive or an assembly reference?)
This occurs in web.config on the following line:
<add namespace="Telerik.Web.Mvc.UI" />
I know the DLL is present in the bin folder on the host, so I'm a bit lost as to what else could be wrong.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
它可能位于 bin 文件夹中,但是由于您没有提及这一点,您实际上是否在项目中添加了对该文件的引用?添加对 dll 的引用后,它应该正确构建
it might be in the bin folder but, since you didn't mention this, did you actually add reference to the file in the project? after adding the reference to the dll, it should build correctly
如果您使用 Razor,则此行:
必须出现在
~/Views/web.config
中,而不是出现在~/web.config
中。这可能是你的情况吗?像这样:
If you are using Razor this line:
must occur in
~/Views/web.config
and not in~/web.config
. Could this be your case?Like this:
http://www.telerik.com/community/forums/aspnet-mvc/general/issue-with-telerik-mvc3-razor-content-appearing-at-the-top.aspx
阅读 Mike Kidder 的回复。抱歉链接另一个论坛,我知道这很烦人,但我宁愿在适当的时候给予认可。
http://www.telerik.com/community/forums/aspnet-mvc/general/issue-with-telerik-mvc3-razor-content-appearing-at-the-top.aspx
Read the reply by Mike Kidder. Sorry for linking another forum, I know that's annoying but I'd rather give credit where due.
您必须将引用的程序集的 Copy Local 设置为 true。在您的情况下,展开引用,选择程序集,按 F4 打开属性并将“复制本地”设置为 true。该程序集很可能安装在 GAC 中,因此当您添加对它的引用时,默认情况下“复制本地”为 false。
You have to set Copy Local to true for the assemblies you have referenced. In your case expand References, select the assembly, press F4 to open the properties and set Copy Local to true. The assembly most probably is installed in the GAC so when you add a reference to it by default Copy Local is false.