c# – 使用Microsoft Identity和构建解决方案时警告CS1702
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了c# – 使用Microsoft Identity和构建解决方案时警告CS1702,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3354字,纯文字阅读大概需要5分钟。
内容图文
![c# – 使用Microsoft Identity和构建解决方案时警告CS1702](/upload/InfoBanner/zyjiaocheng/827/b934a69bed1a48f79191d245b22f849c.jpg)
我已经四处寻找这个bug的解决方案但是还没找到,甚至在SO上.我得到的警告是这样的:
(0,0): warning CS1702: Assuming assembly reference 'Microsoft.Owin.Security.OAuth,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' matches
'Microsoft.Owin.Security.OAuth, Version=2.0.2.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35', you may need to supply runtime policy
Validation Complete
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
这是我的Bin目录的样子:
这是packages.config文件:
<packages>
<package id="EntityFramework" version="6.0.2" targetFramework="net45" />
<package id="Microsoft.AspNet.Identity.Core" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Identity.EntityFramework" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Identity.Owin" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Owin" version="2.1.0" targetFramework="net45" />
<package id="Microsoft.Owin.Host.SystemWeb" version="2.1.0" targetFramework="net45" />
<package id="Microsoft.Owin.Security" version="2.0.2" targetFramework="net45" />
<package id="Microsoft.Owin.Security.Cookies" version="2.0.2" targetFramework="net45" />
<package id="Microsoft.Owin.Security.OAuth" version="2.0.2" targetFramework="net45" />
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net45" />
<package id="Owin" version="1.0" targetFramework="net45" />
</packages>
在我的web.config文件中,运行时部分如下所示:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.0.2.0" newVersion="2.0.2.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.0.2.0" newVersion="2.0.2.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.0.2.0" newVersion="2.0.2.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
您认为我需要做些什么才能摆脱这种警告?
谢谢.
解决方法:
您的项目文件可能仍在引用先前版本的程序集.
您可以通过选择项目中的References下的Microsoft.Owin.Security.OAuth引用并查看属性来快速检查;但我建议你也检查你的项目文件的内容,并检查该程序集的参考,例如:
<Reference Include="Microsoft.Owin.Security.OAuth, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\packages\Microsoft.Owin.Security.OAuth.2.0.0\lib\net45\Microsoft.Owin.Security.OAuth.dll</HintPath>
</Reference>
检查参考版本和HintPath版本是否符合预期.
如果您查看解决方案的Packages文件夹,您可能会发现仍有多个版本的Microsoft.Owin.Security.OAuth,这可能是一个线索. (您可以重命名或删除所有不需要的版本,以查看会发生什么).
如果仍然没有达到足够的程度,请打开构建日志记录详细信息以查看是否可以为您提供更多线索.
为此,在Visual Studio中转到工具>选项>项目和解决方案>构建并运行,并将MSBuild项目构建日志文件详细程度更改为“正常”或“详细”.
内容总结
以上是互联网集市为您收集整理的c# – 使用Microsoft Identity和构建解决方案时警告CS1702全部内容,希望文章能够帮你解决c# – 使用Microsoft Identity和构建解决方案时警告CS1702所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。