.Net 4.0 System.Web.Security.MembershipProvider 引用不明确?
我最近将 BlogEngine.Net 安装升级到 1.6 和 .Net 4.0,但是,在执行升级时我没有构建 BlogEngine.Core。但是,当我现在尝试构建 BlogEngine.Core 项目时,编译失败,因为它无法加载 (System.Web.Security.)MembershipProvider 的符号。我认为这是 .Net/C#/user 问题,而不是 BlogEngine 问题。
该项目引用了System.Web 库,并且类文件(继承自MembershipProvider)包含一个Using for System.Web.Security。启用 ReSharper 后,IntelliSense 会指示使用哪个成员资格提供程序的混乱,并提供两个同名的库 (System.Web.Security) 的选择。
是什么导致了这种含糊不清的引用?如何确定正在引用哪两个库?没有任何明显的迹象表明重复的引用。话又说回来,一旦你看到它,显而易见的事情就真的很明显了。
I have recently upgraded my BlogEngine.Net installation to 1.6 and .Net 4.0, however, I did not build BlogEngine.Core when I performed the upgrade. However, when I try to build the BlogEngine.Core project now, the compile fails because it cannot load the symbols for (System.Web.Security.)MembershipProvider. I believe this to be a .Net/C#/user problem rather than a BlogEngine issue.
The project has a reference to the library System.Web, and the class file (which inherits from MembershipProvider) includes a Using for System.Web.Security. With ReSharper enabled, IntelliSense indicates confusion as to which membership provider to use giving a choice of two libraries of the same name (System.Web.Security).
What could have caused this ambiguous reference? How can I determine which two libraries are being referenced? Nothing obvious indicates a duplicate reference. Then again, the obvious is really obvious once you see it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题解决了。 System.Web.Security 命名空间是 System.Web 的成员,但它也是 System.Web.ApplicationServices 的成员。该项目引用了 System.Web,并且 using 语句引用了 System.Web.Security,因此 IntelliSense 在指定类时不会抛出标志。但是,该项目缺少对 System.Web.ApplicationServices 的引用。该项目引用了该类,但无法加载该类,因为缺少包含的程序集 (...ApplicationServices)。
Problem solved. System.Web.Security namespace is a member of System.Web, however, it is also a member of System.Web.ApplicationServices. The project had a reference to System.Web, and a using statement referenced System.Web.Security, so IntelliSense did not throw a flag when specifying the class. However, the project was missing a reference to to System.Web.ApplicationServices. The project had a reference to the class, but it could not load the class because the containing assembly (...ApplicationServices) was missing.
在为我的网络应用程序创建自定义会员资格提供程序时,我刚刚处理了同样的问题。您需要删除对 System.Web 的引用并添加以下引用。
- 系统.Web.ApplicationServices
- 系统配置
I just dealt with this same issue when creating a custom membership provider for my web application. You need to remove the reference to System.Web and add the following references.
- System.Web.ApplicationServices
- System.Configuration