[英]Visual Studio 2012 Website “Add References” not remember added references
我们最近将解决方案更新为.NET 4.5。
我试图使用以前在System.Web.Security中的“ MembershipUser”类。 根据我的阅读,它已移至System.Web.ApplicationServices。 我们的解决方案有许多C#项目和2个网站。 因此,我右键单击有问题的网站,转到“添加参考”,转到“程序集”>“框架”,然后单击“ System.Web.ApplicationServices”旁边的复选框。 它将以下行添加到我的Web.Config中:
<add assembly="System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
好,很好。 然后,我转到需要使用MembershipUser的页面,而MembershipUser仍然出错(找不到类型或名称空间)。 因此,我再次右键单击该站点以确保我正确添加了引用,并且System.Web.ApplicationServices旁边没有任何检查。
因此它位于Web.Config中,我可以在Using语句中调用它,但是无法获取MembershipUser类进行注册。
我在尝试添加此参考文献时错过了什么吗?
好,我想我明白了。 问题的一部分出现在我们的Web.config中。
我将c#和vb的CompilerVersions更改为4.0:
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="CompilerVersion" value="v4.0"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="CompilerVersion" value="v4.0"/>
<providerOption name="OptionInfer" value="true"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>
此外,我们的编译目标框架未指定4.0。
<compilation debug="true" batch="false" batchTimeout="7200" targetFramework="4.0">
现在建立网站后,MembershipUser现在就会出现,正如我期望的那样。 哈萨
此外,现在在“添加引用”对话框中检查System.Web.ApplicationServices。
从2.0升级到4.5的进展并不顺利。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.