3

I am somewhat new to using the Global Assembly Cache in .NET, and have a question regarding how it works since I haven't been able to find anything online.

My msi(created using Visual Studio Installer extension (using Visual Studio 2015)) installs a number of assemblies into the GAC and my application(the assemblies need to be in the GAC because 3rd party application need to access them too). After running the installer and starting the application, I noticed that when I start my application, copies of the dlls from the GAC are made in the application execution directory.

My question is, is this how using assemblies from GAC normally works? I assumed that the assemblies would just be loaded from the GAC without making local copies. Or is this some error on my part and how I built my application(CopyLocal is set to true but from what I understand, this only matters for Visual Studio and has no effect on actual execution after deployment).

  • `While testing I noticed that when I start my application` you mean your installed app or from Visual Studio > debug? – Deepak Sharma Dec 05 '18 at 08:49
  • @DeepakSharma I installed the app on a test machine and ran the application. – Aleksandar Malovic Dec 05 '18 at 08:51
  • 1
    That is certainly not normal nor is there a mechanism for that. Only somewhat sensible explanation is that your installer put them there since your bin\Release directory had them there. Deploy to c:\program files, it is write-protected by UAC. – Hans Passant Dec 05 '18 at 08:52
  • @HansPassant I checked all the directories after installation, the dlls are not there until I first run the application. – Aleksandar Malovic Dec 05 '18 at 08:53
  • 1
    Well, I suppose that MSI can do that with its "self-healing" option. Google "msi self healing" to learn more about it. – Hans Passant Dec 05 '18 at 09:13
  • @HansPassant Thank you for the tip, it appears that it is indeed msi self-healing kicking in. Which means that my installer is having some issues and assumes the files need to be there. Thank you for the help. – Aleksandar Malovic Dec 05 '18 at 09:29

1 Answers1

1

Based on Hans' input, the issue is with my msi and is not GAC related. While msi installs the assemblies to GAC and not the execution directory, when the application is run it is msi "self-healing" that creates the files, they are not copied from GAC.