Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build using VSBuild@1 with latest version of VS 2022 #15537

Closed
SophisticatedConsulting opened this issue Nov 23, 2021 · 9 comments
Closed
Labels
Area: ABTT Akvelon Build Tasks Team area of work Area: Build bug

Comments

@SophisticatedConsulting

Type: Bug

Enter Task Name: VSBuild@1

Environment

  • Server - Azure Pipelines

Issue Description

Cannot build using VSBuild@1 with latest version of VS 2022 (since 17.0.1 - was working with 17.0.0)

trigger:
- master

variables:
  buildConfiguration: 'Release'
  azureSubscription: 'Pay-As-You-Go Dev/Test(f1117562-7f8f-4c07-bfc5-0a79c44c5606)'
  azureWebApp: 'BikeServiceAPI'

pool:
  vmImage: 'windows-latest'  

stages:
- stage: BuildAndUnitTest

  jobs:
  - job: Build
    variables:
      solution: '**/*.sln'
      buildPlatform: 'Any CPU'

    steps:
    - task: UseDotNet@2
      displayName: 'Install .NET SDK specified in global.json'
      inputs:
        packageType: 'sdk'
        version: '6.0.x'

    - task: NuGetToolInstaller@1
      inputs:
        versionSpec: 
        checkLatest: true

    - task: NuGetCommand@2
      inputs:
        command: 'restore'
        restoreSolution: '$(solution)'
        feedsToUse: 'config'
        noCache: true

    - task: VSBuild@1
      inputs:
        solution: '$(solution)'
        vsVersion: '17.0'
        msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
        platform: '$(buildPlatform)'
        configuration: '$(buildConfiguration)'
        msbuildArchitecture: 'x64'

Task logs

Pipeline executes correctly up to VSBuild.
On commencing the VSBuild it now reports... and the build fails (service migrated to .NET 6)
##[warning]Visual Studio version '17.0' not found. Falling back to version '16.0'.

@EzzhevNikita EzzhevNikita added the Area: ABTT Akvelon Build Tasks Team area of work label Nov 23, 2021
@ghost ghost self-assigned this Nov 24, 2021
@ghost
Copy link

ghost commented Nov 24, 2021

Hello @SophisticatedConsulting , could you please try to use windows-2022 as vmImage to use VS2022?

pool:
  vmImage: 'windows-2022' 

"windows-latest" doesn't contain VS 2022, only VS 2019: https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#visual-studio-enterprise-2019
and windows-2022 has VS 2022: https://github.com/actions/virtual-environments/blob/main/images/win/Windows2022-Readme.md#visual-studio-enterprise-2022

@SophisticatedConsulting
Copy link
Author

Thanks @tatyana-kostromskaya.
This works, though it is hardly intuitive that windows-latest gets an older version (same with visual studio 'latest').
This pipeline worked just a week ago (building .NET 6 code on VS 2022 with windows-latest) and something was obviously changed on the Azure DevOps side to break it.

However, I now have a new problem: VSTest@2 - you cannot set this to use VS 2022... from config this is not available and if I code it into the task:
vsTestVersion: '17.0'
this fails:
Given test platform version 17.0 is not supported.

with
vsTestVersion: '16.0'
I get:
Error: Visual Studio NaN is not found. Try again with a version that exists on your build agent machine.

@ghost
Copy link

ghost commented Nov 25, 2021

@SophisticatedConsulting, Please try to delete vsTestVersion or replace it with vsTestVersion: 'latest'

@SophisticatedConsulting
Copy link
Author

Latest or no vsTestVersion gets VS 2015! (which of course is not installed on the windows-2022 agent).

@SophisticatedConsulting
Copy link
Author

@tatyana-kostromskaya ... please see response above.

@ghost
Copy link

ghost commented Nov 25, 2021

@SophisticatedConsulting , which task version do you have? Could you please share debug logs of VSTest task without vsTestVersion specified?

@SophisticatedConsulting
Copy link
Author

Hi @tatyana-kostromskaya.
I have just run it again and it now finds the right version and executes (has someone fixed this... it was not previously working?)
It is VSTest@2 and runs immediately after the yaml in the first post above.

    - task: VSTest@2
      inputs:
        platform: '$(buildPlatform)'
        configuration: '$(buildConfiguration)'

Run with this config, I now have the following output:
Attempting to find vstest.console from a visual studio installation with version [17.0,18.0).
VS 2022 still cannot be specified in the settings panel or in the yaml (and this seems somewhat contrary to the way Build and Agent interpret 'latest' as previous versions.
I would strongly suggest someone checks through this and makes sure that 'latest' consistently means latest. I have reasonably assumed it is there so new versions are automatically used and I do not need to correct my yaml each time there is a new release? I wasted a lot of time on this.
Thanks for your help.

@ghost
Copy link

ghost commented Nov 25, 2021

@SophisticatedConsulting, you can find announcements regarding windows-2022 in this issue:actions/runner-images#4488

May I close this ticket?

@SophisticatedConsulting
Copy link
Author

Hi @tatyana-kostromskaya.
Thanks for the link.
I still think there should be consistency across the Azure Pipeline tasks regarding what 'latest' means. If it does not yet mean VS2022 for VSBuild and Windows-2022 for the windows agent this should be the same for VSTest. Also VS2022 needs be an explicit option in VSTest (it is currently not)... as shown above.
Thank you again for your help.

@ghost ghost closed this as completed Nov 25, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: ABTT Akvelon Build Tasks Team area of work Area: Build bug
Projects
None yet
Development

No branches or pull requests

2 participants