Based on the self-service VSTS-BuildAgent for VS 2017 with the error "TransformWebConfig task cannot be loaded [...]"

We made the switch to Visual Studio 2017 and there were problems with our self-organized build agent, which gets its work from VSTS.

One step of the VSTS build creates all the solutions using "Visual Studio Build: Build Solution ***. Sln" using "Visual Studio Version: Visual Studio 2017".
The following error occurs in all of our projects in which the "main ASP.NET Core.NET project (.NET Core)" was the selected project type.

C: \ Program Files (x86) \ Microsoft Visual Studio \ 2017 \ Professional \ MSBuild \ Sdks \ Microsoft.NET.Sdk.Publish \ build \ netstandard1.0 \ TransformTargets \ Microsoft.NET.Sdk.Publish.TransformFiles. Objectives (54.5): error MSB4062: task "TransformWebConfig" cannot be loaded from assembly C: \ Program Files (x86) \ Microsoft Visual Studio \ 2017 \ Professional \ MSBuild \ Sdks \ Microsoft.NET.Sdk.Publish \ assembly \ netstandard1.0 .... \ tools \ net46 \ Microsoft.NET.Sdk.Publish.Tasks.dll. Could not load file or assembly: /// 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 download a program with the wrong format. Make sure the declaration is correct, that the assembly and all its dependencies are available, and that the task contains an open class that implements Microsoft.Build.Framework.ITask.

Additional Information:

  • In Visual Studio 2017, solutions are built without errors.
  • None of our projects include .config conversion files (but they include .config files, such as web.config), an error still occurs.
  • Visual Studio 2017 Build Tools, as well as the full Visual Studio 2017, were installed on the build server and, for example, the .NET Core Class libraries compile perfectly.
  • Installed versions of .NET Core are identical between build servers and developer machines.
  • The same errors also occur when using "MsBuild: Build Solution ***. Sln" as the build step for all solutions and choosing "MSBuild: MSBuild 15.0".
  • File referred to as "Failed to load file or assembly: C: \ Program Files (x86) \ Microsoft Visual Studio \ 2017 \ Professional \ MSBuild \ Sdks \ Microsoft.NET.Sdk.Publish \ tools \ net46 \ Microsoft. NET.Sdk .Publish.Tasks.dll "exists in the specified path.
  • There are no tasks defined in the .csproj files.

Has anyone understood what could cause this?

+7
visual-studio asp.net-core visual-studio-2017 msbuild vsts-build-task
source share
2 answers

Take a look at this link. It looks like the problem has been previously fixed.

https://github.com/Microsoft/msbuild/issues/1010

However, another change has recently been added to MSBuild (see above). My guess is that this "downgrade" leads to ignoring the "fix" (using the wrong version of the DLL)

https://github.com/aspnet/Scaffolding/pull/321

0
source share

Have a look below: https://github.com/aspnet/websdk/pull/174

I reported the same behavior, and this turns out to be a problem only in the 64-bit version of MSBuild, returning to the 32-bit version, which worked for me until it fixes.

+2
source share

All Articles