question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Web deployment task failed. (The type initializer for 'Microsoft.Web.Deployment.DeploymentManager' threw an exception.)

See original GitHub issue

We’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:open
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
joeloffcommented, Apr 7, 2021

@vijayrkn Are we still waiting on the IIS team?

1reaction
vijayrkncommented, May 22, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found