Question

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

Was it helpful?

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).

OTHER TIPS

Try changing the target framework from 4.0 to 3.5, that should do the trick.

Even though you yourself are an Admin, it does not mean that apps that you run will be elevated to admin. In fact, VS 2010 will NOT be, nor will most others. You actually have to right-click "Run as Admin...". I actually set my VS start menu shortcut's properties to "Run as Administrator" so that I never forget, as I was burned on this too.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top