How to configure OmniSharp on NixOS to work with .NET Framework 4.8 projects?

Body:

I’m trying to use OmniSharp on NixOS with a .NET Framework 4.8 project, but it fails with MSBuild errors.

Setup:

  • NixOS with omnisharp-roslyn package installed
  • .NET Framework 4.8 web application project

The Problem:
When OmniSharp tries to load the project, it throws:

Microsoft.Build.Exceptions.InvalidProjectFileException: The imported project "/nix/store/ycrx2bz5b4l7ylgafkz11ll74nxx5g3l-dotnet-sdk-8.0.413/share/dotnet/sdk/8.0.413/Microsoft/VisualStudio/v17.0/WebApplications/Microsoft.WebApplication.targets" was not found.

Analysis:

  • The NixOS omnisharp-roslyn package appears to be the .NET 6+ version
  • It’s looking for .NET SDK paths that don’t exist for .NET Framework projects
  • .NET Framework 4.8 projects need different MSBuild tooling

Questions:

  1. Does the NixOS omnisharp-roslyn package include the net472 build needed for .NET Framework projects?
  2. How can I configure OmniSharp to use Mono and appropriate MSBuild tools for .NET Framework 4.8?
  3. Should I manually install the omnisharp-mono.tar.gz variant instead?
  4. What’s the recommended approach for .NET Framework development on NixOS?

Any pointers?:wink: