colindembovsky / cols-agent-tasks

Colin's ALM Corner Custom Build Tasks
MIT License
83 stars 65 forks source link

vswhere not included in Task Folder on Build Agent #121

Closed divgo closed 5 years ago

divgo commented 5 years ago

we are seeing an issue where the "vswhere.exe" tool is expected to be in the Task Folder on the build agent, but the tool does not exist in the Task Folder on the build agent.


##[debug]Dac Framework (installed with SQL) not found on machine 7A4F853A7B1B
##[debug]Dac Framework (installed with DAC Framework) not found on machine 7A4F853A7B1B
##[debug]Getting latest Visual Studio 15 setup instance.
##[debug]Entering Invoke-VstsTool.
##[debug] FileName: 'C:\BuildAgent\_work\_tasks\DacPacReport_1ebf2967-63b3-4372-89f7-6799108a22f0\1.2.79\vswhere.exe'
##[debug] Arguments: '-version [15.0,16.0) -latest -format json'
##[debug] RequireExitCodeZero: 'True'
**##[command]"C:\BuildAgent\_work\_tasks\DacPacReport_1ebf2967-63b3-4372-89f7-6799108a22f0\1.2.79\vswhere.exe" -version [15.0,16.0) -latest -format json**
##[debug]Leaving Invoke-VstsTool.
##[debug]Invoke-Expression : The term 
##[debug]'**C:\BuildAgent\_work\_tasks\DacPacReport_1ebf2967-63b3-4372-89f7-6799108a22f0\1.2.79\vswhere.exe' is not recognized as** 
##[debug]the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was 
##[debug]included, verify that the path is correct and try again.
##[debug]At C:\BuildAgent\_work\_tasks\DacPacReport_1ebf2967-63b3-4372-89f7-6799108a22f0\1.2.79\ps_modules\VstsTaskSdk\ToolFunct
##[debug]ions.ps1:83 char:9
##[debug]+         Invoke-Expression "& '$FileName' --% $Arguments"
##[debug]+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##[debug]    + CategoryInfo          : ObjectNotFound: (C:\BuildAgent\_....79\vswhere.exe:String) [Invoke-Expression], CommandN 
##[debug]   otFoundException
##[debug]    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.InvokeExpressionCommand
##[debug] 
##[debug]```

We first tried copying vswhere to the system32 directory on the host, thinking the call might work if the tool was in a location defined in PATH, but the Task still failed.

We then copied vswhere.exe into the actual Task Folder on the host and once we did this, the Task completed successfully. 

```##[debug] FileName: 'C:\BuildAgent\_work\_tasks\DacPacReport_1ebf2967-63b3-4372-89f7-6799108a22f0\1.2.79\vswhere.exe'
##[debug] Arguments: '-version [15.0,16.0) -latest -format json'
##[debug] RequireExitCodeZero: 'True'
##[command]"C:\BuildAgent\_work\_tasks\DacPacReport_1ebf2967-63b3-4372-89f7-6799108a22f0\1.2.79\vswhere.exe" -version [15.0,16.0) -latest -format json
##[debug][
##[debug]  {
##[debug]    "instanceId": "d2313f65",
##[debug]    "installDate": "2019-05-06T13:53:46Z",
##[debug]    "installationName": "VisualStudio/15.9.11+28307.586",
##[debug]    "installationPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise",
##[debug]    "installationVersion": "15.9.28307.586",
##[debug]    "productId": "Microsoft.VisualStudio.Product.Enterprise",
##[debug]    "productPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\devenv.exe",
##[debug]    "isPrerelease": false,
##[debug]    "displayName": "Visual Studio Enterprise 2017",
##[debug]    "description": "Microsoft DevOps solution for productivity and coordination across teams of any size",
##[debug]    "channelId": "VisualStudio.15.Release",
##[debug]    "channelUri": "https://aka.ms/vs/15/release/channel",
##[debug]    "enginePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service",
##[debug]    "releaseNotes": "https://go.microsoft.com/fwlink/?LinkId=660692#15.9.11",
##[debug]    "thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=660708",
##[debug]    "updateDate": "2019-05-06T13:53:46.9299396Z",
##[debug]    "catalog": {
##[debug]      "buildBranch": "d15.9",
##[debug]      "buildVersion": "15.9.28307.586",
##[debug]      "id": "VisualStudio/15.9.11+28307.586",
##[debug]      "localBuild": "build-lab",
##[debug]      "manifestName": "VisualStudio",
##[debug]      "manifestType": "installer",
##[debug]      "productDisplayVersion": "15.9.11",
##[debug]      "productLine": "Dev15",
##[debug]      "productLineVersion": "2017",
##[debug]      "productMilestone": "RTW",
##[debug]      "productMilestoneIsPreRelease": "False",
##[debug]      "productName": "Visual Studio",
##[debug]      "productPatchVersion": "11",
##[debug]      "productPreReleaseMilestoneSuffix": "1.0",
##[debug]      "productRelease": "RTW",
##[debug]      "productSemanticVersion": "15.9.11+28307.586",
##[debug]      "requiredEngineVersion": "1.18.1049.33485"
##[debug]    },
##[debug]    "properties": {
##[debug]      "campaignId": "",
##[debug]      "channelManifestId": "VisualStudio.15.Release/15.9.11+28307.586",
##[debug]      "nickname": "",
##[debug]      "setupEngineFilePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vs_installershell.exe"
##[debug]    }
##[debug]  }
##[debug]]
##[debug]Exit code: 0
##[debug]Leaving Invoke-VstsTool.```

This seems like a bug where the vswhere.exe tool is expected in the Task Folder, but does not exist there. 
colindembovsky commented 5 years ago

Duplicate of #117