Reputation: 133
'Visual studio build solution task' in the Azure pipeline has latest visual studio version selected. However from the console log I can find it is not selecting the latest version (2022) instead it is selecting the 2017 version.
Even in the console log of my previous task (Nuget restore) I can see it is picking only the 2017 version.
Is there a way that I change the solution to Visual studio version 2019.
Note: Main reason I want to use 2019 version is because current version of my MSBuild is not compatible with VS version 2017. Because of this my pipeline is failing.
Is there a way I can change the VS version in Azure Devops pipeline. Can someone guide me please?
Upvotes: 1
Views: 4005
Reputation: 21
Since you are not providing a basic pipeline yml file (maybe you are using classic instead of yml?), we can only guess.
Is there a possibility that the NuGetCommand task is finding a solution file in your repo that references the 2017 version of VS?
NuGetCommand will "restore" (install) the version it finds unless something else overrides.
Upvotes: 0
Reputation: 1389
Is there a way I can change the VS version in Azure Devops pipeline?
You can use a MSBUILD task and switch from Version to Specify Location and insert the path to the msbuild.exe of VS2022.
Ex:
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\msbuild.exe
.
Look at the screenshot below:
Note: Please make sure your path is correct in the MSBuild.exe task.
Upvotes: 3