C# – Could not load file or assembly Microsoft.Owin 3.0.0 to 3.0.1

azurecnet

Interesting dependency issue…

VS2015.3, .NET45 updating Microsoft.Owin from 3.0.0 to 3.0.1 (traced this update to be the problem – wanting to install https://www.nuget.org/packages/IdentityServer3.AccessTokenValidation/)

enter image description here
it works locally on IIS Express

but publish to Azure website: (am removing additional files at destination on azure publish straight from VS). restarted and deleted all files from azure webserver too.

enter image description here

web.config translation looks okay

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

Edit
Bruce Chen's answer pointed me in the direction of Kudu (Azure – Development Tools, Advanced Tools)

enter image description here

I downloaded the Owin dll, and it was the wrong version ie 3.0.0

To fix I cleared out all package artifacts from my solution

git clean -xfd (be careful)

Then rebuilt

Best Answer

I wasted a couple of hours on this too because the reference installed by nuget had version 3.0.0 despite the nuget package being labelled 3.0.1

Making the old version newer than the new version fixed my problem:

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

*Edit: I think(but not certain) that the reason my version was still 3.0.0.0 was because the bin folder got caught in my repo and nuget didn't want to write over the dll