-refonly (C# Compiler Options)

The -refonly option indicates that a reference assembly should be output instead of an implementation assembly, as the primary output. The -refonly parameter silently disables outputting PDBs, as reference assemblies cannot be executed. This option corresponds to the ProduceOnlyReferenceAssembly project property of MSBuild.




Reference assemblies are a special type of assembly that contain only the minimum amount of metadata required to represent the library's public API surface. They include declarations for all members that are significant when referencing an assembly in build tools, but exclude all member implementations and declarations of private members that have no observable impact on their API contract. For more information, see Reference assemblies in .NET Guide.

The -refonly and -refout options are mutually exclusive.

See also