سؤال

I am trying to use the GacInstall provider to deploy .Net 4.5 assemblies via the Windows Management Service to the target machine. This is part of our continuous deployment. It unfortunately does not seem to work.

I suspect that the operation is not supported based on the description at http://technet.microsoft.com/en-us/library/gg607836(v=ws.10).aspx

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.

When I try to deploy the Web Deploy package containing the GAC assemblies locally on the target machine, it works fine. Anyway, local deployment is not what we need for the continuous deployment.

Did anybody succeeded deploying .Net 4.5 assemblies to GAC via WMSvc?

Here are the relevant deployment logs:

Local deployment

SetParameters from:
"C:\CloudConnect\Rewriter.SetParameters.xml"
You can change IIS Application Name, Physical path, connectionString
or other deploy parameters in the above file.
-------------------------------------------------------
 Start executing msdeploy.exe
-------------------------------------------------------
 "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -source:package='C:
\CloudConnect\Rewriter.zip' -dest:auto,includeAcls="False" -verb:sync -disableLi
nk:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtens
ion -setParamFile:"C:\CloudConnect\Rewriter.SetParameters.xml"
Info: Adding sitemanifest (sitemanifest).
Info: Adding gacAssembly (D:\dev\cloudcon\Web\packages\AutoMapper.3.1.0\lib\net4
0\AutoMapper.dll).
Info: Adding gacAssembly (D:\dev\cloudcon\Web\Common\Dto\bin\Release\CloudConnec
t.Dto.dll).
Info: Adding gacAssembly (D:\dev\cloudcon\Web\CloudConnect.Portal\Provisioning\M
odels\bin\Release\CloudConnect.Portal.Provisioning.Models.dll).
Info: Adding gacAssembly (D:\dev\cloudcon\Web\CloudConnect.Portal\Provisioning\R
epositories\bin\Release\CloudConnect.Portal.Provisioning.Repositories.dll).
Info: Adding gacAssembly (D:\dev\cloudcon\Web\Rewriter\RewriteProvider\bin\Relea
se\CloudConnect.RewriteProvider.dll).
Info: Adding gacAssembly (D:\dev\cloudcon\Web\packages\EntityFramework.5.0.0\lib
\net45\EntityFramework.dll).
Info: Adding gacAssembly (D:\dev\cloudcon\Web\packages\log4net.2.0.3\lib\net40-f
ull\log4net.dll).
Info: Updating file (Rewriter\bin\AutoMapper.dll).
Info: Updating file (Rewriter\bin\CloudConnect.Dto.dll).
Info: Updating file (Rewriter\bin\CloudConnect.Portal.Provisioning.Models.dll).
Info: Updating file (Rewriter\bin\CloudConnect.Portal.Provisioning.Repositories.
dll).
Info: Updating file (Rewriter\bin\CloudConnect.RewriteProvider.dll).
Info: Updating file (Rewriter\bin\EntityFramework.dll).
Info: Updating file (Rewriter\bin\log4net.dll).
Info: Updating file (Rewriter\bin\Rewriter.dll).
Info: Updating file (Rewriter\Rewriter.wpp.targets).
Info: Updating file (Rewriter\Web.config).
Info: Adding ACL's for path (Rewriter)
Info: Adding ACL's for path (Rewriter)
Total changes: 20 (8 added, 0 deleted, 12 updated, 0 parameters changed, 1695348
 bytes copied)

WMSvc deployment

[MSDeployPublish] VSMSDeploy (7s)
[02:22:48][VSMSDeploy] Starting Web deployment task from source: package(C:\BuildAgent\work\4a097252cfabe817\Rewriter\Rewriter\obj\Release\Package\Rewriter.zip) to Destination: auto().
[02:22:50][VSMSDeploy] Adding sitemanifest (sitemanifest).
[02:22:50][VSMSDeploy] Adding ACL's for path (Rewriter)
[02:22:50][VSMSDeploy] Adding ACL's for path (Rewriter)
[02:22:55][VSMSDeploy] Adding sitemanifest (sitemanifest).
[02:22:55][VSMSDeploy] Adding gacAssembly (C:\BuildAgent\work\4a097252cfabe817\packages\AutoMapper.3.1.0\lib\net40\AutoMapper.dll).
[02:22:55][VSMSDeploy] Adding gacAssembly (C:\BuildAgent\work\4a097252cfabe817\Common\Dto\bin\Release\CloudConnect.Dto.dll).
[02:22:55][VSMSDeploy] Adding gacAssembly (C:\BuildAgent\work\4a097252cfabe817\CloudConnect.Portal\Provisioning\Models\bin\Release\CloudConnect.Portal.Provisioning.Models.dll).
[02:22:55][VSMSDeploy] Adding gacAssembly (C:\BuildAgent\work\4a097252cfabe817\CloudConnect.Portal\Provisioning\Repositories\bin\Release\CloudConnect.Portal.Provisioning.Repositories.dll).
[02:22:55][VSMSDeploy] Adding gacAssembly (C:\BuildAgent\work\4a097252cfabe817\Rewriter\RewriteProvider\bin\Release\CloudConnect.RewriteProvider.dll).
[02:22:55][VSMSDeploy] Adding gacAssembly (C:\BuildAgent\work\4a097252cfabe817\packages\EntityFramework.5.0.0\lib\net45\EntityFramework.dll).
[02:22:55][VSMSDeploy] Adding gacAssembly (C:\BuildAgent\work\4a097252cfabe817\packages\log4net.2.0.3\lib\net40-full\log4net.dll).
[02:22:55][VSMSDeploy] Updating file (Rewriter\bin\CloudConnect.Dto.dll).
[02:22:55][VSMSDeploy] Updating file (Rewriter\bin\CloudConnect.Portal.Provisioning.Models.dll).
[02:22:55][VSMSDeploy] Updating file (Rewriter\bin\CloudConnect.Portal.Provisioning.Repositories.dll).
[02:22:55][VSMSDeploy] Updating file (Rewriter\bin\CloudConnect.RewriteProvider.dll).
[02:22:55][VSMSDeploy] Updating file (Rewriter\bin\Rewriter.dll).
[02:22:55][VSMSDeploy] Updating file (Rewriter\Web.config).
[02:22:55][VSMSDeploy] Adding ACL's for path (Rewriter)
[02:22:55][VSMSDeploy] Adding ACL's for path (Rewriter)
[02:22:55][VSMSDeploy] Successfully executed Web deployment task.
[02:22:55][VSMSDeploy] Publish Succeeded.
هل كانت مفيدة؟

المحلول

"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe"

Yes, that works. You can get that tool installed on your web server as well, download it from here. Which is the recommended way to do this.

Noodling a bit about the underlying problem, the issue is that WMSvc didn't have a time machine to guess what would happen in .NET 4.0. A rather big change in that .NET version is that the GAC is stored in a different directory. It used to be present in c:\windows\assembly in previous .NET versions, it got moved to c:\windows\microsoft.net\assembly in .NET 4.0

This matters a great deal when you need to register assemblies in the GAC of course, whatever tool does the registration needs to pick the correct GAC directory. On your desktop machine, it is done by having two distinct versions of gacutil.exe.

MSDeploy is unfortunately wonky about it as well, as pointed out in the article you linked, the content of the msdeploy.exe.config file matters. Version 3 contains this one:

<configuration>
  <startup  useLegacyV2RuntimeActivationPolicy="true" >
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
    <supportedRuntime version="v2.0.50727" />
  </startup>
</configuration>

In other words, it is suitable for .NET 4.0 and 4.5 web projects, but not for projects that target earlier versions. If that's important then either keep multiple versions around or edit the file (Notepad is fine) and swap the two <supportedRuntime> elements so v2.0 is first. Locking in the .NET target version is of course best.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top