all groups > dotnet distributed apps > october 2007 >
You're in the

dotnet distributed apps

group:

Registering The Assembly In the GAC Programmatically


Registering The Assembly In the GAC Programmatically Wayne Berry
10/3/2007 9:49:01 PM
dotnet distributed apps:
Excuse me if this is not the right newgroup for this, questions. If it isn't
tell me the right group and I will repost.

I would like to register my assembly in the GAC without calling gacutil.exe,
gacutil.exe requires that it be run from the command line, which means that
when I want to register an assembly from my Windows application (WinForms In
C#) I have to spin up a process to execute the console application
(gacutil.exe) from the command line, leaving an annoying flash of the command
box.

What I would like it to be able to register the assembly via an API call,
instead of a console application. How can I do this?

I have already used reflector on regasm.exe and regsvcs.exe and coverted
that code to a Class Library that I can call from my windows application,
just need to figure out have to convert gacutil.exe, since it is not Managed
code I can't use reflector on it.

Kind Regards,
RE: Registering The Assembly In the GAC Programmatically stcheng NO[at]SPAM online.microsoft.com
10/4/2007 12:00:00 AM
Hi Wayne,

For installing Assembly into GAC without GACUtil(in code), you may consider
using the Fusion API(unmanaged via COM). Here is a tech article introducing
this:

#Using the .NET Fusion API to Manipulate the GAC
http://www.codeguru.com/columns/kate/article.php/c12793/

In addition, if you're building a setup program, it is recommended you use
the windows installer sdk or VS setup project's built-in feature instead of
manually write the code to do so. Here is another blog article mentioned
this:

#Why to not use gacutil.exe in an application setup
http://blogs.msdn.com/astebner/archive/2006/11/04/why-to-not-use-gacutil-exe
-in-an-application-setup.aspx

BTW, if you meet any .net specific questions and not sure which subarea to
fit, you can feel free to post in the following general groups:

microsoft.public.dotnet.general
microsoft.public.dotnet.framework

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
[quoted text, click to view]
AddThis Social Bookmark Button