C
C#5mo ago
AdamBlade

Updating Packages on old application problems

Hello, I'm currently trying to upgrade some old apps I'm currently working on and I'm facing a weird issue where it works fine locally but refuses to work deployed. The problem is that it cannot seem to load an assembly when deployed. I've set all references to copy local but I'm still facing issues. The apps are a Asp.Net WebForms app and an Asp.Net Web Api. The package it's complaining about it Microsoft.Web.Infrastructure,I've updated it from 1.0.0.0 to 2.0.0.0. Any insight would be appreciated, I cannot get this error to replicate locally. This is the error: [FileLoadException: Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.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)] System.Web.WebPages.PreApplicationStartCode.Start() +0 System.Web.Mvc.PreApplicationStartCode.Start() +39 [InvalidOperationException: The pre-application start initialization method Start on type System.Web.Mvc.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.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).]
2 Replies
fenixblades
fenixblades5mo ago
goto your project references in visual studio, right click that reference, and check its properties to see its physical location. is it some local packages directory on your machine or is it your bin directory?
AdamBlade
AdamBlade5mo ago
@trustie The path is C:\Projects\MasterApp\Locator.WebApi\bin\Microsoft.Web.Infrastructure.dll In my projects folder As far as I can tell it's trying to read the wrong version, even though I specified bindingRedirect <dependentAssembly> <assemblyIdentity name="Microsoft.Web.Infrastructure" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> </dependentAssembly>