Visual Studio looks for an older assembly version on the very first run

1

Visual Studio Professional 2017 Version 15.7.4

I have a web project (MVC) that whenever I run it from visual studio, it opens the browser (I have reproduced it in both Chrome and IE) and shows the following error:

Could not load file or assembly 'Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

However, if I refresh the browser, it goes ahead and works as intended. Technically speaking I can work around it, but it has been getting annoying and time consuming. And I have no idea what's going on.

I've tried restarting both VS and Windows (server 2012 r2), checked the GAC (found nothing), I checked all references to Owin in my project and I see nothing that references v2.1, and I even have a binding redirect on my web.config

  <dependentAssembly>
    <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
  </dependentAssembly>

I've looked into mostly how to fix the kind of error exception I am getting, but I haven't found anything similar and I am guessing there's some sort of cache or default option in VS that is trying to look for the older version on the first run, but I don't know where to look for it.

Any ideas?

visual-studio
visual-studio-2017
asked on Stack Overflow Jul 2, 2018 by CPay

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0