![]() |
VOOZH | about |
dotnet add package Basic.Reference.Assemblies.NetStandard20 --version 1.8.9
NuGet\Install-Package Basic.Reference.Assemblies.NetStandard20 -Version 1.8.9
<PackageReference Include="Basic.Reference.Assemblies.NetStandard20" Version="1.8.9" />
<PackageVersion Include="Basic.Reference.Assemblies.NetStandard20" Version="1.8.9" />Directory.Packages.props
<PackageReference Include="Basic.Reference.Assemblies.NetStandard20" />Project file
paket add Basic.Reference.Assemblies.NetStandard20 --version 1.8.9
#r "nuget: Basic.Reference.Assemblies.NetStandard20, 1.8.9"
#:package Basic.Reference.Assemblies.NetStandard20@1.8.9
#addin nuget:?package=Basic.Reference.Assemblies.NetStandard20&version=1.8.9Install as a Cake Addin
#tool nuget:?package=Basic.Reference.Assemblies.NetStandard20&version=1.8.9Install as a Cake Tool
Roslyn is a powerful API for C# and Visual Basic compilations. Provide it code, a few options, and a set of references and it will provide an API to inspect the syntax, semantic model, diagnostics and even generate DLLs / EXEs.
Getting reference assemblies to use with a Compilation is challenging because they are only shipped with development tools. In order to use them in a library, the developer must do the heavy lifting of packaging them up as resources in their library and unpacking them at runtime.
The Basic.Reference.Assemblies library takes care of this heavy lifting and provides reference assemblies for net10.0, netstandard2.0 and net472 target frameworks. These can be easily integrated into the existing Roslyn APIs.
using Microsoft.CodeAnalysis.CSharp;
using Basic.Reference.Assemblies;
using System.IO;
using System.Reflection;
var code = @"
using System;
public static class Example
{
public static void Main()
{
var tuple = (Part1: ""hello"", Part2: ""world"");
Console.WriteLine($""{tuple.Part1} {tuple.Part2}"");
}
}
";
var compilation = CSharpCompilation
.Create(
"HelloWorld.dll",
new[] { CSharpSyntaxTree.ParseText(code) },
references: ReferenceAssemblies.Net80);
using var stream = new MemoryStream();
var emitResults = compilation.Emit(stream);
stream.Position = 0;
var assembly = Assembly.Load(stream.ToArray());
var method = assembly.GetType("Example").GetMethod("Main");
method.Invoke(null, null); // Prints "Hello World"
This package also adds extensions methods for easily retargeting Compilation instances to different target frameworks.
CSharpCompilation compilation = ...;
compilation = compilation.WithReferenceAssemblies(ReferenceAssemblyKind.Net80);
The expectation is that most developers will use Basic.Reference.Assemblies. This package has reference assemblies for the latest supported target frameworks and provides APIs to easily switch between them in Compilation instances.
Developers who only need a single target framework and are extremely size conscious can grab the target framework specific package:
Packages for older target frameworks are also available:
typeof(Enumerable).Assembly?Developers working on .NET Framework will often end up with the following pattern for creating Compilation instances:
Assembly systemCoreAssembly = typeof(System.Linq.Enumerable).Assembly;
string systemCorePath = systemCoreAssembly.Location;
MetadataReference systemCoreRef = AssemblyMetadata.CreateFromFile(path).GetReference();
This pattern will often work on .NET Framework but will fail when running on .NET Core. The reason for this is due to the differences in reference and implementation assemblies. Reference assemblies are designed for use at build time, while implementation assemblies are used at runtime. A particular type for a given target framework doesn't necessarily live in the same reference and implementation assembly. Also, the set of implementation assemblies can be larger than the reference assemblies for the same target framework.
The reason the above tends to work on .NET Framework is that the split between reference and implementation assemblies is not as pronounced. In most cases, there is a 1:1 relationship. On .NET Core, the split is much more pronounced, and it often requires probing for implementation assemblies to get a set which will work for building. This is a fragile process, though, and developers are much better off using the reference assemblies as intended by the .NET team.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 3 NuGet packages that depend on Basic.Reference.Assemblies.NetStandard20:
| Package | Downloads |
|---|---|
|
ANcpLua.Roslyn.Utilities.Testing
Fluent testing framework for Roslyn analyzers, code fixes, and incremental generators with caching validation, forbidden type detection, and comprehensive assertion support. |
|
|
NTypewriter.Runtime
App-independent engine used to run NTypewriter from UI |
|
|
SourceGeneratorTestHelpers
Test helpers and extension methods to simplify testing of .NET source generators. |
Showing the top 8 popular GitHub repositories that depend on Basic.Reference.Assemblies.NetStandard20:
| Repository | Stars |
|---|---|
|
dotnet/roslyn
The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
|
|
|
nuke-build/nuke
🏗 The AKEless Build System for C#/.NET
|
|
|
dotnet/dotnet
Home of .NET's Virtual Monolithic Repository which includes all the code needed to build the .NET SDK.
|
|
|
icsharpcode/CodeConverter
Convert code from C# to VB.NET and vice versa using Roslyn
|
|
|
NeVeSpl/NTypewriter
File/code generator using Scriban text templates populated with C# code metadata from Roslyn API.
|
|
|
X-Sharp/XSharpPublic
Public repository for the source code for the XSharp Compiler, Runtime, Project System and Tools.
|
|
|
jxnkwlp/abp-elsa-module
Elsa abp module and workflow app
|
|
| dotnet/apisof.net |
| Version | Downloads | Last Updated |
|---|---|---|
| 1.8.9 | 0 | 6/18/2026 |
| 1.8.8 | 331 | 5/18/2026 |
| 1.8.7 | 359 | 5/8/2026 |
| 1.8.6 | 253 | 4/29/2026 |
| 1.8.5 | 6,577 | 4/13/2026 |
| 1.8.4 | 9,674 | 11/26/2025 |
| 1.8.3 | 13,759 | 7/22/2025 |
| 1.8.2 | 423 | 5/29/2025 |
| 1.8.1 | 286 | 5/26/2025 |
| 1.8.0 | 2,001 | 1/6/2025 |
| 1.7.9 | 9,628 | 9/19/2024 |
| 1.7.8 | 913 | 8/28/2024 |
| 1.7.7 | 310 | 8/23/2024 |
| 1.7.6 | 280 | 8/23/2024 |
| 1.7.5 | 309 | 8/21/2024 |
| 1.7.4 | 552 | 8/16/2024 |
| 1.7.3 | 376 | 8/15/2024 |
| 1.7.2 | 13,612 | 5/7/2024 |
| 1.7.1 | 308 | 5/1/2024 |
| 1.7.0 | 264 | 5/1/2024 |