-1

I'd like to ship my program only with an executable, so I'm using Costura.Fody to embed resources in my assembly. But theres a problem.. I'm programmatically adding some assemblies (which also would be embedded) (b.e MyDll.dll) to the GAC:

using System.EnterpriseServices.Internal;

Publish publish = new Publish();
publish.GacInstall("C:\Temp\MyDll.dll"); //path to my dll

It would work normally if I would ship the dll's separately with the exe but is there a way I can obtain a path from my executing program of MyDll.dll assembly which is embedded in the executable and save it like that to the GAC?

Community
  • 1
  • 1
eMi
  • 5,540
  • 10
  • 60
  • 109
  • Any reason you want it in the GAC? If not try using Assembly.Load() to load the assemblies directly from the byte arrays embedded in your file. Methods like GetAssembly will not work with byte arrays. See https://msdn.microsoft.com/en-us/library/system.reflection.assembly.load%28v=vs.110%29.aspx – Paul Zahra May 22 '15 at 11:45
  • You should not use the GAC, unless you want to end up in dll-hell :) – Thorarins May 22 '15 at 12:22
  • Is it possible to load the byte array of your embedded assembly and write it to a "save place" and then load it into the GAC ? I am not quite sure what you are trying to accomplish with the GAC – Bongo May 22 '15 at 13:20

1 Answers1

-1

Your dll will be in the application bin folder, so you can find it using

AppDomain.CurrentDomain.BaseDirectory 

and run code to register it in post install

One more thing worth mentioning: The dll will not be installed if it is not signed

Yuri
  • 2,820
  • 4
  • 28
  • 40