I have updated to Microsoft.Web.Infrastructure package to version 2.0, but site fails when trying to load version 1.0

John Marshall 15 Reputation points
2023-06-22T15:18:45.29+00:00

I have a Visual Studio project that has a reference to Microsoft.Web.Infrastructure version 2.0. I updated from version 1.0 using the Package Manager. Now the website gives me an error during startup:
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)

The package.config has an entry for version 2.0.0

The web.config has a <dependentAssembly> with a version of 2.0.0.0.

I have searched the entire project for 'Microsoft.Web.Infrastructure' and every place its found has version 2.0

Why is it trying to load version 1.0?

Developer technologies | Visual Studio | Other
{count} votes

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 31,056 Reputation points Microsoft External Staff
    2023-06-23T06:26:53.8233333+00:00

    Hi @John Marshall, 

    Welcome to Microsoft Q&A! 

    Please close all running Visual Studio Instances and manually delete the bin and obj folders in your project folder.

    Then, rebuild your solution. 

    Sincerely,

    Anna


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.