I am trying to create a build definition for an asp.net core application. My project compiles on the Visual Studio and also with MSBuild. When I am trying to run the solution on Azure to compile is where it fails to show the message below:
C:\Program Files\dotnet\sdk\2.2.105\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\TransformTargets\Microsoft.NET.Sdk.Publish.TransformFiles.targets(49,5): Error MSB4018: The "TransformWebConfig" task failed unexpectedly.
System.Exception: In process hosting is not supported for AspNetCoreModule. Change the AspNetCoreModule to atleast AspNetCoreModuleV2.
at Microsoft.NET.Sdk.Publish.Tasks.WebConfigTransform.TransformAspNetCore(XElement aspNetCoreElement, String appName, Boolean configureForAzure, Boolean useAppHost, String extension, String aspNetCoreModuleName, String aspNetCoreHostingModel)
at Microsoft.NET.Sdk.Publish.Tasks.WebConfigTransform.Transform(XDocument webConfig, String appName, Boolean configureForAzure, Boolean useAppHost, String extension, String aspNetCoreModuleName, String aspNetCoreHostingModel, String environmentName)
at Microsoft.NET.Sdk.Publish.Tasks.TransformWebConfig.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
Process 'msbuild.exe' exited with code '1'.
The weird thing is that I have currently installed on my computer the SDK 2.2.300 with Runtime 2.2.5, but when I am running the build definition in the VSTS it seems that the SDK it is using is 2.2.105. My initial thought was that the VSTS agent didn't have the correct version, and it was running with 2.2.105. After running a self-hosted agent, the error is the same.
Seeing online the details on the VSTS agents, I found that the highest .NetCore dependency they have installed is SDK 2.2.105. Going under agent's details, you can read
.NET Core
The following runtimes and SDKs are installed:
Environment:
PATH: contains location of dotnet.exe
SDK:
2.2.105 C:\Program Files\dotnet\sdk\2.2.105
2.2.104 C:\Program Files\dotnet\sdk\2.2.104
2.2.103 C:\Program Files\dotnet\sdk\2.2.103
2.2.102 C:\Program Files\dotnet\sdk\2.2.102
I was trying to troubleshoot on this way:
- Wait for Microsoft to update their online agents
- Create an on-prem agent(self-hosted agent), running on your localhost where you have all the dependencies installed
- try to add a step that installs the SDK as part of the agent's tasks(see the image below), but unfortunately, I couldn't make it work
Any thoughts?