Skip to content

Instantly share code, notes, and snippets.

@eocron
Last active April 24, 2019 08:17
Show Gist options
  • Save eocron/2035ced18767b3ebe5508dac701a0dd6 to your computer and use it in GitHub Desktop.
Save eocron/2035ced18767b3ebe5508dac701a0dd6 to your computer and use it in GitHub Desktop.
References assembly through type reference, so assembly will be copied on build even, if it is not used explicitly (for example, plugins not used until some point in application, but need to be copied). Works in Release mode too.
public static class AssemblyReference
{
/// <summary>
/// Installs reference to assembly in which specified type resides.
/// It will be copied on build even in release mode.
/// </summary>
/// <typeparam name="T"></typeparam>
[MethodImpl(MethodImplOptions.NoInlining)]
public static void Install<T>()
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment