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.

"TransformWebConfig" task could not be loaded

See original GitHub issue

We experience this error when building new VS2017 csproj project with msbuild 2015:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\TransformTargets\Microsoft.NET.Sdk.Publish.TransformFiles.targets(54,5): error MSB4062: The "TransformWebConfig" task could not be loaded from the assembly C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\..\..\tools\net46\\Microsoft.NET.Sdk.Publish.Tasks.dll. Could not load file or assembly 'file:///C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Sdks\Microsoft.NET.Sdk.Publish\tools\net46\Microsoft.NET.Sdk.Publish.Tasks.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. 

Also it seems some other people experience it as well. See and

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

vijayrkncommented, Jan 14, 2019

@night-king - The log shows that you have an incorrect configuration setup. You cannot have inprocess hosting with AspNetCoreModule.

Can you add this to the csproj? This should fix the issue.


senjcommented, Apr 5, 2017

It may be the same reason for a special case, but same is true for Service Fabric’s *.sfproj projects.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The "TransformWebConfig" task failed unexpectedly - ...
The "TransformWebConfig" task failed unexpectedly - System.Exception: The acceptable value for AspNetCoreModuleHostingModel property is either.
Read more >
dotnet publish error - The "TransformWebConfig" task ...
This transformation fails because the web. config is not correct to be used with an in process ASP.NET Core application.
Read more >
Publishing ASP.NET Core app from Visual Studio 2022 to ...
When I try to publish my ASP.NET Core app from VS 2022 (latest version) to Azure, the publishing fails in case the projects...
Read more >
Running on VSTS an core sln I got: Error MSB4018
Running on VSTS an core sln I got: Error MSB4018: The “TransformWebConfig” task failed unexpectedlyClosed - Not a Bug1 6.
Read more >
Not able to publish .NET Core Web App to folder with error ...
Not able to publish .NET Core Web App to folder ... TransformFiles.targets(49,5): Error MSB4018: The "TransformWebConfig" task failed unexpectedly. System.
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 Post

No results found

github_iconTop Related Hashnode Post

No results found