Skip to content

Dotnet 9 "Could not load file or assembly" for non-existent AspNetCore packages #211

@franswah

Description

@franswah

I have been struggling to upgrade our AspNetCore service to dotnet 9 due to our use of TypeGen and strange errors I am seeing in our CI/CD pipeline. I unfortunately have not been able to reproduce these errors locally, only when running on our ubuntu build agent.

When running the dotnet-typegen tool, I get a long list of errrors like:

 Could not resolve assembly: Microsoft.AspNetCore.Mvc.Core, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 in any of the searched directories: C:\Users\VssAdministrator\.nuget\packages\; C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages; C:\Program Files\dotnet\shared
  Could not resolve assembly: Microsoft.AspNetCore.Mvc.Core, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 in any of the searched directories: C:\Users\VssAdministrator\.nuget\packages\; C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages; C:\Program Files\dotnet\shared
  Could not resolve assembly: Microsoft.AspNetCore.Mvc.Core, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 in any of the searched directories: C:\Users\VssAdministrator\.nuget\packages\; C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages; C:\Program Files\dotnet\shared
  Could not resolve assembly: Microsoft.AspNetCore.Mvc.Core, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 in any of the searched directories: C:\Users\VssAdministrator\.nuget\packages\; C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages; C:\Program Files\dotnet\shared
  Could not resolve assembly: Microsoft.AspNetCore.Html.Abstractions, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 in any of the searched directories: C:\Users\VssAdministrator\.nuget\packages\; C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages; C:\Program Files\dotnet\shared
  Could not resolve assembly: Microsoft.AspNetCore.Html.Abstractions, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 in any of the searched directories: C:\Users\VssAdministrator\.nuget\packages\; C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages; C:\Program Files\dotnet\shared

Eventually leading to

TypeGen.Core.CoreException: Error generating type dependencies for 'Model'
   ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Core, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

It complains about several AspNetCore packages, many of which are deprecated and not in our dependency tree, and most don't even exist with 9.0 versions. I may just need better understanding of what is going on under the hood in TypeGen for it to be looking for these assemblies in order to figure out if there is something wrong with how our build pipeline is set up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions