Dependency error in Vs 2019

Erum Mirza 1 Reputation point
2021-07-14T08:14:03.687+00:00

i m facing below error while working in vs 2019

Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,303 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Yijing Sun-MSFT 7,071 Reputation points
    2021-07-14T09:46:35.72+00:00

    Hi @Erum Mirza ,
    It appears that Microsoft.Web.Infrastructure.dll is not being installed in the GAC, even if .net (4.0 or 4.5 or other) are installed successfully on Windows Server. On localhost (typically Windows client), it seems like it is being in the GAC when the tools/platform (Visual Studio etc.) are installed.
    As one possible fix, please try the following:

    1. Run the following command in the Package Manager Console. (If you are using Visual Studio, this can be reached via menu options "Tools --> Library Package Manager --> Package Manager Console:) PM> Install-Package Microsoft.Web.Infrastructure You will see the following messages if it is successfully installed. Successfully installed 'Microsoft.Web.Infrastructure 1.0.0.0.
      Successfully added 'Microsoft.Web.Infrastructure 1.0.0.0' to Web.
    2. You will notice that Microsoft.Web.Infrastructure.dll has now been added as a Reference (can be seen in the references folder of your project in in Solution Explorer)
    3. If you look at the properties of this reference you will notice that "Copy Local" has been set to "True" by default.
    4. Now when you "Publish " your project, Microsoft.Web.Infrastructure.dll will be deployed.

    Best regards,
    Yijing Sun


    If the answer is helpful, please click "Accept Answer" and upvote it.

    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.

    0 comments No comments