System.Runtime dll not found

Dhawan, Riya 0 Reputation points
2023-10-16T06:03:23.5266667+00:00

I am trying to load a .dll file using Assembly assembly = Assembly.LoadFrom(dllPath); and then i'm looking for types in the assembly Type[] types = assembly.GetTypes(); but this is continuously giving me loader exceptions as
{"Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.":"System.Runtime, Version=4.2.2.0, Culture=neutral,}System.Exception {System.IO.FileNotFoundException}
I have tried adding the System.Runtime file from the NuGet packages and still the same error is coming up. I am working in .Net4.8 framework

Developer technologies .NET .NET Runtime
Developer technologies .NET Other
{count} votes

1 answer

Sort by: Most helpful
  1. Jiachen Li-MSFT 34,221 Reputation points Microsoft External Staff
    2023-10-17T02:57:29.0366667+00:00

    Hi @Dhawan, Riya ,

    If you open the project as a folder, it will result in an error that the System.Runtime dll cannot be found.

    Please make sure you open your project through the .csproj file.

    Best Regards.

    Jiachen Li


    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

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.