Skip to main content

Load Assembly Dynamically

In order to Copy NuGet dependecies to the output folder add this to classlibrary.csproj:

<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

Set the Output directory with

<BaseOutputPath>$(SolutionDir)AppName\bin</BaseOutputPath>

To load Assembly the best approach is to use

Assembly module = Assembly.LoadFrom(filePath);

To check if type A can be assigned to a variable with type B:

B.IsAssignableFrom(A)