Web deployment task failed. (The type initializer for 'Microsoft.Web.Deployment.DeploymentManager' threw an exception.)
See original GitHub issueWe’re seeing this error on some machines but not others. Error:
O:\.NetCoreCache\sdk\3.1.200\Sdks\Microsoft.NET.Sdk.Publish\targets\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeployPackage.targets(84,5): Web deployment task failed. (The type initializer for 'Microsoft.Web.Deployment.DeploymentManager' threw an exception.) [X:\bt\1110002\repo\src\Samples\WebSdkPackage\WebSdkPackage.csproj]
This task comes from the .NET SDK here:
O:\.NetCoreCache\sdk\3.1.200\Sdks\Microsoft.NET.Sdk.Publish\targets\..\tools\net46\Microsoft.NET.Sdk.Publish.Tasks.dll
With these dependencies:
Package/Publish task Microsoft.NET.Sdk.Publish.Tasks.MsDeploy.VSMSDeploy load assembly Microsoft.Web.Deployment, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Package/Publish task Microsoft.NET.Sdk.Publish.Tasks.MsDeploy.VSMSDeploy load assembly Microsoft.Web.Delegation, Version=7.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
On working machines, we see these DLLs in the package:
- Microsoft.NET.Sdk.Publish.Tasks.dll
- Microsoft.Web.Delegation.dll
- Microsoft.Web.Deployment.dll
- Microsoft.Web.XmlTransform.dll
On working machines, this DLL is also pulled in (via fusion logs):
Microsoft.Web.Deployment.Tracing
LOG: Found assembly by looking in the GAC.
LOG: Binding succeeds. Returns assembly from C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Web.Deployment.Tracing\v4.0_9.0.0.0__31bf3856ad364e35\Microsoft.Web.Deployment.Tracing.dll.
LOG: Assembly is loaded in default load context.
So this guy is coming in from the GAC in the successful case.
Since .NET Core is supposedly portable and xplat, I’m not sure why anything would depend on the GAC…
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (6 by maintainers)
Top Results From Across the Web
c# - Web deployment task failed. (The type initializer for ' ...
(The type initializer for 'Microsoft.Web.Deployment.DeploymentManager' threw an exception.) I suddenly started getting this error! I published ...
Read more >Azure Publish failed exception
MSDeploy.targets(140,5): Error : Web deployment task failed. (The type initializer for 'Microsoft.Web.Deployment.DeploymentManager' threw an ...
Read more >Troubleshoot Web Deploy problems with Visual Studio
Web deployment task failed.(Could not connect to the destination computer ("deployserver") using the specified process ("The Web Management ...
Read more >Troubleshoot common problems related to Web Deploy
This article describes how to diagnose and fix common problems with Web Deploy, including common errors seen while publishing from Visual ...
Read more >C# – Web deployment task failed. (The type initializer for ' ...
Web.Deployment.DeploymentManager' threw an exception.) I suddenly started getting this error! I published my website many many times with all the same settings, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@vijayrkn Are we still waiting on the IIS team?
yes, Agreed.
When WebDeploy was updated to work with mono, WebDeploy team only provided us with these 2 dlls. In NuGet I can see that their official package ships all these 3 dlls - https://www.nuget.org/packages/Microsoft.Web.Deployment/3.6.0.
Let me check with them to see if the official package contains all these fixes. If it does, will switch websdk to use the official package which will allow us to redist all these 3 dlls.