我已经四处寻找这个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 ==========
Run Code Online (Sandbox Code Playgroud)
这是我的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>
Run Code Online (Sandbox Code Playgroud)
在我的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>
Run Code Online (Sandbox Code Playgroud)
您认为我需要做些什么才能摆脱这种警告?
谢谢.
您的项目文件可能仍在引用先前版本的程序集.
您可以通过选择项目中的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>
Run Code Online (Sandbox Code Playgroud)
检查参考版本和HintPath版本是否符合预期.
如果您查看解决方案的Packages文件夹,您可能会发现仍有多个版本的Microsoft.Owin.Security.OAuth,这可能是一个线索.(您可以重命名或删除所有不需要的版本,以查看会发生什么).
如果仍然没有达到足够的程度,请打开构建日志记录详细信息以查看是否可以为您提供更多线索.
为此,在Visual Studio中,转到" 工具" >" 选项" >" 项目和解决方案" >" 构建并运行",然后将MSBuild项目构建日志文件详细信息更改为" 正常"或" 详细".
| 归档时间: |
|
| 查看次数: |
8778 次 |
| 最近记录: |