Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warning CS1702 when using Microsoft Identity and building solution

Tags:

c#

asp.net

I've looked around for solutions to this bug but have not found one, even on SO. The warning I get is this:

(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 ==========

This is what my Bin directory looks like:

enter image description here

Here's the packages.config file:

<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>

In my web.config file, there's the runtime section that looks like this:

  <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>

What do you think I need to do to get rid of this warning?

Thanks.

like image 799
frenchie Avatar asked Mar 05 '14 14:03

frenchie


1 Answers

Your project file might still be referencing a previous version of the assembly.

You can quickly check that by selecting the Microsoft.Owin.Security.OAuth reference under the References in the project, and looking at the properties; but I'd advise you also check the contents of your project file, and check the Reference for that assembly, for example:

<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>

Check that both the reference version, and the HintPath version are what you would expect.

If you look at your solution's Packages folder, you might find multiple versions of Microsoft.Owin.Security.OAuth still in there, and that could be a clue. (You could rename or delete all the versions you don't want, to see what happens).

If that still doesn't get you far enough, turn up the build logging detail to see if that can provide more clues for you.

To do that, in Visual Studio go to Tools > Options > Projects and Solutions > Build and Run, and change the MSBuild project build log file verbosity to Normal or Detailed.

like image 112
David Moore Avatar answered Nov 02 '22 11:11

David Moore