JetBrains.Refasmer 2.0.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package JetBrains.Refasmer --version 2.0.0                
NuGet\Install-Package JetBrains.Refasmer -Version 2.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="JetBrains.Refasmer" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JetBrains.Refasmer --version 2.0.0                
#r "nuget: JetBrains.Refasmer, 2.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install JetBrains.Refasmer as a Cake Addin
#addin nuget:?package=JetBrains.Refasmer&version=2.0.0

// Install JetBrains.Refasmer as a Cake Tool
#tool nuget:?package=JetBrains.Refasmer&version=2.0.0                

Refasmer official JetBrains project

Simple tool to make reference assembly. Strips method bodies, private class fields etc. Also can generate xml files like FrameworkList.xml. Can be used as library (Refasmer.dll).

Installation

You could download refasmer from GitHub: https://github.com/JetBrains/Refasmer/releases or install as .NET Tool: dotnet tool install -g JetBrains.Refasmer.CliTool

NuGet packages

Package Version
JetBrains.Refasmer Nuget
JetBrains.Refasmer.CliTool Nuget

Usage:

refasmer [options] <dll> [<**/*.dll> ...]
Options:
  -v                         increase verbosity
  -q, --quiet                be quiet
  -h, -?, --help             show help
  -c, --continue             continue on errors
  -O, --outputdir=VALUE      set output directory
  -o, --output=VALUE         set output file, for single file only
  -r, --refasm               make reference assembly, default action
  -w, --overwrite            overwrite source files
  -p, --public               drop non-public types even with InternalsVisibleTo
  -i, --internals            import public and internal types
      --all                  ignore visibility and import all
      --omit-non-api-members=VALUE
                             omit private members and types not participating
                               in the public API (will preserve the empty vs
                               non-empty struct semantics, but might affect
                               unmanaged struct constraint)
  -m, --mock                 make mock assembly instead of reference assembly
  -n, --noattr               omit reference assembly attribute
  -l, --list                 make file list xml
  -a, --attr=VALUE           add FileList tag attribute
  -g, --globs                expand globs internally: ?, *, **

(note the executable is called RefasmerExe.exe if built locally; refasmer is a name of an executable installed by dotnet tool install)

Mock assembly throws System.NotImplementedException in each imported method.

Reference assembly contains only type definition and method signatures with no method bodies.

By default, if you don't specify any of --public, --internals, or --all, Refasmer will try to detect the refasming mode from the input assembly. If the assembly has an InternalsVisibleTo attribute applied to it, then --internals will be implicitly applied; otherwise, --public will.

[!IMPORTANT] Note that --omit-non-api-members performs a nontrivial transformation on the resulting assembly. Normally, a reference assembly should include any types, including private and internal ones, because this is up to the spec. However, in some cases, it is possible to omit private and internal types from the reference assembly, because they are not part of the public API, while preserving some of the value type semantics. In these cases, Refasmer is able to remove these types from the assembly, sometimes emitting synthetic fields in the output type. This will preserve the difference of empty and non-empty struct types, but will not preserve the type blittability (i.e. some types after refasming might obtain the ability to follow the unmanaged constraint, even if this wasn't possible before refasming).

If you didn't specify the --all option, you must pass either --omit-non-api-members true or --omit-non-api-members false, to exactly identify the required behavior of refasming.

Examples:

refasmer -v -O ref -c a.dll b.dll c.dll

will handle all passed DLL files continuing on errors. Output dlls will be placed to ./ref directory

refasmer -l -a Redist="Microsoft-Windows-CLRCoreComp.3.5" -a Name=".NET Framework 3.5" -a RuntimeVersion="3.5" -a ShortName="Full" a.dll b.dll c.dll > FrameworkList.xml

will generate FrameworkList for all passed DLL files with root tag

<FileList Redist="Microsoft-Windows-CLRCoreComp.3.5" Name=".NET Framework 3.5" RuntimeVersion="3.5" ShortName="Full">

Documentation

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on JetBrains.Refasmer:

Package Downloads
MTGOSDK.MSBuild

An MSBuild library that manages the code-generation of the SDK. This builds reference assemblies containing only the public types and members of internal classes from the MTGO client and does not handle or contain any implementation details or private code.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on JetBrains.Refasmer:

Repository Stars
JetBrains/resharper-unity
Unity support for both ReSharper and Rider
Version Downloads Last updated
2.0.1 132 12/31/2024
2.0.1-pre01 89 12/28/2024
2.0.0 116 11/20/2024
1.0.33 863 5/15/2023
1.0.32 529 2/2/2023
1.0.31 291 1/30/2023
1.0.30 475 5/26/2022
1.0.27 481 1/19/2022
1.0.26 470 1/19/2022
1.0.25 449 1/19/2022
1.0.24 548 12/9/2021
1.0.18 348 8/13/2021
1.0.12 2,261 9/24/2020

[Changed]

- (Breaking change!) A new mandatory parameter --omit-non-api-types (pass either true or false).
This parameter determines when to preserve or omit private nested types in value types. We have made it mandatory since the previous changes in the value type behavior might've been caused confusion in cases when the user wanted to remove all the private API from an assembly.
--omit-non-api-types false closely corresponds to the behavior from 1.0.33; --omit-non-api-types true corresponds to the behavior from 1.0.32.
Refasmer now does its best to preserve some of the value type semantics even with --omit-non-api-types true: it will emit synthetic private field in a value type even if it has removed all the fields before. Note that this change might not preserve the type blittability and still affect the compilation.