Search code examples
c#hookeasyhook

Easyhook fires "Unable to install assembly in the GAC" error on vs2010


I'm still trying to run my easyhook exercize. right now, i get this error:

      System.ApplicationException: Unable to install assembly in the GAC. This usually indicates either an invalid assembly path or you are not admin.
   at EasyHook.NativeAPI.GacInstallAssembly(IntPtr InContext, String InAssemblyPath, String InDescription, String InUniqueID)
   at EasyHook.Config.Register(String InDescription, String[] InUserAssemblies)
   at HookTest.Program.Main()

and the problem seems to originate here:

        Config.Register(
            "Easy hook test",
            "Hook Test.vshost.exe",
            "TestInject.dll");

The solution I'm trying to build is composed by two projects, a library and an application. Once I build the solution, i copy testinject.dll to the hooktest debug folder, and then I run it in debug mode. Maybe I should use an absolute path to indicate where testinject.dll is? or add the library somewhere?

UPDATE 1

            "Easy hook test",
            @"Hook Test.vshost.exe",
            @"I:\Documents and Settings\foo\Desktop\Hook Test\TestInject\bin\Debug\TestInject.dll");

Even with this change, I get the same error


Solution

  • This usually indicates either an invalid assembly path or you are not admin.

    That's as good an error message as you can expect. The path could be wrong because you don't specify the full path of the assembly (i.e. c:\mumble\foo.dll). You commonly don't have admin rights because of UAC. Use a manifest to get the privilege elevation or run Visual Studio in admin mode (change the desktop shortcut).