-1

Small question : If a dll is being referenced from C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.1, how does an application link/finds that during runtime? (or when launched without VS)?

Is it from GAC or the dll is copied into executable location at runtime?

Yeasin Abedin Siam
  • 1,459
  • 2
  • 17
  • 29
  • [How runtime locates assemblies](https://docs.microsoft.com/en-us/dotnet/framework/deployment/how-the-runtime-locates-assemblies) – peeyush singh Apr 25 '19 at 01:48

1 Answers1

0

The Framework you build with (4.6.1) has to be installed on the client (GAC) to run. Standard with normal Windows client/server.

If you want to embed the DLL in your EXE, have a look at Embedding DLLs in a compiled executable.

I highly recommend to use Costura.Fody - by far the best and easiest way to embed resources in your assembly. It's available as NuGet package.

Install-Package Costura.Fody

After adding it to the project, it will automatically embed all references that are copied to the output directory into your main assembly. You might want to clean the embedded files by adding a target to your project:

Install-CleanReferencesTarget
doterik
  • 66
  • 2
  • 4