0 out of 1 rated this helpful - Rate this topic

Publish.GacInstall Method

Installs an assembly in the global assembly cache.

Namespace:  System.EnterpriseServices.Internal
Assembly:  System.EnterpriseServices (in System.EnterpriseServices.dll)
public void GacInstall(
	string AssemblyPath
)

Parameters

AssemblyPath
Type: System.String
The file system path for the assembly.

Implements

IComSoapPublisher.GacInstall(String)
Exception Condition
SecurityException

A caller in the call chain does not have permission to access unmanaged code.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Error checking
This method throws no exception!  ...for anything!
Publish pub = new Publish();
pub.GacInstall("foo");
No error, no exception.  If the path is valid, and the assembly is strongly named, it will get properly installed in the GAC.  Works for target .NET Frame version of assembly.  I.e. a .NET Framework 4.0 app using GacInstall will properly install a 3.5 targeted assembly, etc.

Update (2011/12/13) - After using ILSpy to look at the code for this function, I did discover that errors are sent to the local machine's Event Viewer:

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="COM+ SOAP Services" />
    <EventID Qualifiers="0">0</EventID>
    <Level>3</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2011-12-12T19:40:07.000000000Z" />
    <EventRecordID>528445</EventRecordID>
    <Channel>Application</Channel>
    <Computer>machine name</Computer>
    <Security />
  </System>
  <EventData>
    <Data>Installation in the global assembly cache failed: foo</Data>
  </EventData>
</Event>