Fern-generated .NET SDKs support modern .NET versions, .NET Framework versions, and Unity.
Because these SDKs are built with modern C# features, you’ll need the following even when targeting older .NET Framework targets:
Fern .NET SDKs support all officially supported .NET versions, except for net35.
The C# language version is determined by your compiler, while the target framework determines which runtime and base class library APIs are available. Fern SDKs use modern C# features but compile to older framework versions.
All major IDEs support Fern-generated SDKs when targeting net462, net472, and net48 versions:
<LangVersion> in your project and install the appropriate developer pack.Microsoft.Net.Compilers.Toolset package.<LangVersion> and ensure reference assemblies are available.You can “bring your own compiler” with the Microsoft.Net.Compilers.Toolset package on any environment.
Use the Roslyn compiler (csc) that comes with Visual Studio 2022+ or the .NET SDK. Set your C# version via <LangVersion> to latest, preview, or a specific version (minimum 9).
Fern’s .NET SDK doesn’t support the legacy Mono compiler (mcs, gmcs) or the pre-Roslyn csc.exe compiler. Use Roslyn even when building on Mono.
Use the .NET SDK (dotnet) with the Microsoft.NETFramework.ReferenceAssemblies package to supply net48 references on non-Windows. Use Roslyn via dotnet build or Mono’s MSBuild.
Unity controls its own C# compiler and .NET profile, which affects how you use Fern’s .NET SDK.
Unity compiles projects using Roslyn, typically supporting C# 9 (varies by Unity version). You can’t force Unity to use a newer C# compiler by changing your package because Unity controls the compiler inside the Editor.
Configure this in Unity: Edit → Project Settings → Player → Other Settings → Api Compatibility Level
Unity doesn’t support NuGet packages, so you must manually download and add these assemblies to your Unity project:
Use SDK-style projects where possible, as they provide modern compilers and simpler multi-targeting. If you have a classic project format, consider converting to SDK-style. The legacy projects section covers legacy setups that can’t be converted.
When building for net48 on macOS/Linux, you won’t have the Windows targeting packs. Add the reference assemblies package:
This provides the net48 reference assemblies so Roslyn can compile for net48 on any platform. You’ll still need Mono or Wine to execute the result.
Targeting net48 with modern C#
Install the .NET Framework 4.8 Developer Pack so the net48 reference assemblies are available to the compiler.
For older MSBuild/Visual Studio versions, Visual Studio 2019, or legacy packages.config setups, add a modern Roslyn toolset and target the old framework.
Install the appropriate .NET Framework Developer Pack so Visual Studio can find the reference assemblies.
Add a small shim in your project or reference a helper package.
Microsoft.NETFramework.ReferenceAssemblies to the project (as PrivateAssets=all).Add Microsoft.Net.Compilers.Toolset to the project, or move to VS 2022+.
This error occurs when using the required keyword with older Visual Studio versions. Follow the instructions at Legacy projects to add a modern compiler.
Some versions of Visual Studio may show this error in the IDE but compile the project successfully when using the package-provided compiler.