beyondnet: Could not load `System.Runtime 9.0.0.0`

I’m getting the following error message:

Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

I’ve already added the following to my config.json, both SDKs are installed.

"AssemblySearchPaths": [
	"/usr/local/share/dotnet/sdk/9.0.000",
	"/usr/local/share/dotnet/sdk/9.0.200",
	"/usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0",
	"/usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.2"
]

What else do I need to add? I’m at a loss because the System.Runtime.dll is present in both runtimes.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 22 (12 by maintainers)

Most upvoted comments

@Lancelotbronner Yup, no other dependencies.

Try removing AssemblySearchPaths from your config.

@Lancelotbronner It’s likely that Microsoft.Build.dll is using “fancy” c# features that are not supported by beyondnet. It’s also quite likely that it’s not even AOT compatible. What I would try is to start with a limited scope. Instead of targeting all of Microsoft.Build.dll, target your assembly instead. And within your assembly add a DontStrip.cs file where your reference some of the APIs you want to use from Microsoft.Build.dll so that they don’t get stripped away.

Something like this:

using Microsoft.Build;

namespace beyondnettest;

public class DontStrip
{
    public Microsoft.Build.Graph.ProjectGraph ProjectGraph => null!;
}

This would limit the scope of beyondnet to generate bindings for Microsoft.Build.Graph.ProjectGraph and all the types it uses.