jeudi 6 septembre 2018

System.EnterpriseServices.Internal.Publish().GacInstall Not installing dll into GAC

I have trying to install a dll into GAC using my C# code for some reason. I am not intended to use GACUTIL.exe or something else.

I have referred various questions and forums to do this. but, this is not working for me (not dll installed into GAC) and it is not throwing any execption or security exception. Below is my code which i am trying. any suggestion would be appreciated.

try
{
    if (System.Reflection.Assembly.LoadFile(System.IO.Path.GetFullPath("my.dll")).GetName().GetPublicKey().Length > 0)
    {
        new System.EnterpriseServices.Internal.Publish().GacInstall(System.IO.Path.GetFullPath("my.dll"));
        //Tried by proividng the relative or asbolute path as well.
    }
}
catch(SecurityException ex)
{
  Console.WriteLine(ex.Message);
  Console.WriteLine(ex.StackTrace);
}





Aucun commentaire:

Enregistrer un commentaire