When a DotNet 3.5 solution is build in Azure DevOps with Self hosted Agent having VS 2019 build tools, I am getting the error as below.
##[error]The project file could not be loaded. Root element is missing.
When I change the MSBuild path to specific location as C:\Windows\Microsoft.NET\Framework64\v3.5, then I am getting the error as below.
MSBUILD : error MSB1021: Cannot create an instance of the logger. Could not load file or assembly 'file:///D:\AzureAgent\vsts-agent-win-x64-2.204.0\_work\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824\1.199.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
Switch: CentralLogger,D:\AzureAgent\vsts-agent-win-x64-2.204.0\_work\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824\1.199.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll;RootDetailId=|SolutionDir=D:\AzureAgent\vsts-agent-win-x64-2.204.0\_work\6\s\WinApps|enableOrphanedProjectsLogs=true
Please anyone let me know how to solve this issue.
Thanks.