Hello,
Is there anyway to programmatically add a strong named assembly to the GAC using C# code ?
Thanks
Hello,
Is there anyway to programmatically add a strong named assembly to the GAC using C# code ?
Thanks
This Microsoft Support article, How to install an assembly into the Global Assembly Cache in Visual C#, should explain all you need to know.
This is typically a task performed by the installer, so I'm not sure why you'd want to do it from within a .NET program (unless I've misunderstood your question). However, you can simply use the System.Diagnostics.Process
class to run all the necessary programs as an installer might.
The Global Assembly Cache is configured through a COM-like interface(http://support.microsoft.com/default.aspx?scid=kb;en-us;317540).
For all questions about the GAC, Jungfen Zhang's blog is the source of choice.
http://blogs.msdn.com/junfeng/articles/229648.aspx
http://blogs.msdn.com/junfeng/articles/229649.aspx
For more information, search for "managed GAC API".
Gacutil.exe is only for development purposes and should not be used to install production assemblies into the global assembly cache.
[Microsoft Installer] is the recommended and most common way to add assemblies to the global assembly cache. The installer provides reference counting of assemblies in the global assembly cache, plus other benefits.