共用方式為


Web Deploy gacInstall Provider

Applies To: Windows 7, Windows Server 2008 R2

gacInstall

The gacInstall provider synchronizes a DLL file to GAC assembly, or a GAC assembly to a DLL file.

Example

msdeploy -verb:sync -source:gacInstall="c:\mybuild\My.App.dll" -dest:gacInstall="My.App",computerName=Server2

The gacInstall provider installs a GAC assembly on a destination computer when its corresponding DLL file is not installed on the source computer. This can be useful when the source is a build computer on which you do not want to have the DLL installed in the GAC, or when the source is a package (.zip file). The provider can also take a DLL that is installed in the GAC on the source and copy it as a file on the destination.

The gacInstall provider takes the short name of an assembly as its input. Although you can use the strong name, it is recommended that you use the short name to avoid introducing errors.

The gacInstall provider installs assemblies that have been compiled with the preferred .NET Framework version as specified in the msdeploy.exe.config file, which is located at the following path:

c:\Program Files\IIS\Microsoft Web Deploy V2

The preferred framework version is specified by the first supportedRuntime element. By default this is the .NET Framework 2.0, as shown in the following example:

<configuration>
  <startup>
    <supportedRuntime version="v2.0.50727" />
    <supportedRuntime version="v4.0" />
  </startup>
</configuration>

If you have to install an assembly that has been compiled with the .NET Framework 4, change the order of the supportedRuntime elements to make "v4.0" first. For a remote GAC deployment, the msdepsvc.exe.config file should be changed in the same way.

In Windows Server® 2008 R2, Windows® 7, and earlier operating systems, by default, GAC deployment using Web Management Service (WMSVC) does not work for .NET Framework 4 assemblies.

Important

The gacInstall provider is available only in Web Deploy 2.0 and later versions.

dump

In a dump operation, the gacInstall provider returns the path of the specified source object.

sync

In a sync operation, if the specified assembly and its related program files are not found on the destination computer, they will be copied from the source computer to the destination computer. If the assembly is present on the destination computer, its related files will be updated.

Important

The assembly name you specify for the source and the destination should be the same. The full strong name is defined by the assembly itself, not by the GAC, and therefore cannot be changed. You cannot copy an assembly to another computer and give the assembly a different name on the second computer.

Note

If you want to synchronize an assembly that is installed in the GAC on a source computer to the GAC on a destination computer, you should use the Web Deploy gacAssembly Provider.

Example usages

1) Synchronize the "My.Assembly.dll" file from the local computer and install it in the GAC on Server2.

msdeploy.exe -verb:sync -source:gacInstall="c:\mybuild\My.Assembly.dll" -dest:gacInstall="My.Assembly",computername="Server2",username=Server2User,password=Server2UserPass,authType=basic –allowUntrusted

2) Synchronize the DLL file from the "Contoso.Main.App" assembly in the GAC on the local computer to the "Contoso.Main.App.dll" file on Server2.

msdeploy -verb:sync -source:gacinstall="Contoso.Main.App" -dest:gacinstall="c:\Contoso.Main.App.dll",computername="Server2",username=Server2User,password=Server2UserPass,authType=basic –allowUntrusted