isaacabraham / vsts-fsharp

Azure Devops extension for F#-friendly tools
https://marketplace.visualstudio.com/items?itemName=isaacabraham.fsharp-helpers-extension
Apache License 2.0
13 stars 7 forks source link

VSTS Hosted VS2017 Agent can't find fsi.exe #27

Open jeroenpasman opened 5 years ago

jeroenpasman commented 5 years ago

Description

I'm trying to use the "Execute F# Script" task on a Hosted VS2017 agent, but it gives me the following error: "The system cannot find the path specified.". This is because the task it trying to run fsi.exe from the C:\Program Files (x86)\Microsoft SDKs\F#\4.1\Framework\v4.0\ folder. This used to work, but fsi.exe can now be found in the dotnet core sdk (i.e. C:\Program Files\dotnet\sdk\2.1.400\FSharp). Maybe I'm missing something and this can be fixed easily by my side, but I just can't figure it out.

Repro steps

  1. Create a build pipeline

  2. Set Agent Pool to Hosted VS2017

  3. Add "Execute F# Script" task and select the fsx

  4. Queue the build

Expected behavior

fsx script gets executed

Actual behavior

error: "The system cannot find the path specified."

Details

2018-09-18T09:47:14.7799699Z ##[debug]Evaluating condition for step: 'Deploy Plugins' 2018-09-18T09:47:14.7800261Z ##[debug]Evaluating: succeeded() 2018-09-18T09:47:14.7800455Z ##[debug]Evaluating succeeded: 2018-09-18T09:47:14.7800694Z ##[debug]=> True 2018-09-18T09:47:14.7800952Z ##[debug]Result: True 2018-09-18T09:47:14.7801281Z ##[section]Starting: Deploy Plugins 2018-09-18T09:47:14.7858892Z ============================================================================== 2018-09-18T09:47:14.7859029Z Task : Execute F# Script 2018-09-18T09:47:14.7859124Z Description : Executes an F# .fsx script file 2018-09-18T09:47:14.7859211Z Version : 0.4.1 2018-09-18T09:47:14.7859301Z Author : Isaac Abraham 2018-09-18T09:47:14.7859566Z Help : This task executes an arbitrary .fsx file. 2018-09-18T09:47:14.7859672Z ============================================================================== 2018-09-18T09:47:14.7949577Z ##[debug]Working directory: 'D:\a_tasks\FSharpScript_1ba72b0a-f476-4a91-90a0-b8e7a0cc4337\0.4.1\DefaultTaskWorkingDirectory' 2018-09-18T09:47:14.7951772Z ##[debug]Fail on standard error: 'True' 2018-09-18T09:47:14.7951906Z ##[debug]Modify environment: 'False' 2018-09-18T09:47:14.7952065Z ##[debug]C:\Windows\system32\cmd.exe /c ""C:\Program Files (x86)\Microsoft SDKs\F#\4.1\Framework\v4.0\fsi.exe" "D:\a\1\s\AOMetalektro.CRM\Scripts\Daxif\PluginSyncDev.fsx" " 2018-09-18T09:47:14.7952285Z ##[command]"C:\Program Files (x86)\Microsoft SDKs\F#\4.1\Framework\v4.0\fsi.exe" "D:\a\1\s\AOMetalektro.CRM\Scripts\Daxif\PluginSyncDev.fsx" 2018-09-18T09:47:14.8188366Z ##[error]The system cannot find the path specified.

2018-09-18T09:47:14.8209493Z ##[error]Process completed with exit code 1 and had 1 error(s) written to the error stream. 2018-09-18T09:47:14.8219076Z ##[debug]System.Exception: Process completed with exit code 1 and had 1 error(s) written to the error stream. at Microsoft.VisualStudio.Services.Agent.Worker.Handlers.ProcessHandler.d10.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Services.Agent.Worker.TaskRunner.d24.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Services.Agent.Worker.StepsRunner.d__1.MoveNext() 2018-09-18T09:47:14.8221045Z ##[section]Finishing: Deploy Plugins

Known workarounds

I might be able to run the F# script using powershell, but that would be without using this task entirely.

Related information

https://github.com/Microsoft/azure-pipelines-image-generation/blob/master/images/win/Vs2017-Server2016-Readme.md

isaacabraham commented 5 years ago

Can you test with the latest release?

ScottHutchinson commented 5 years ago

I'm having the same issue after reinstalling Windows 10 on my developer PC. It was working before the reinstall, but now fsi.exe is in a different location. What's the best way to run F# scripts?

This is my batch .cmd file:

:: Create a temporary drive letter mapped to your UNC root location
:: and effectively CD to that location
pushd %~dp0
"C:\Program Files (x86)\Microsoft SDKs\F#\4.0\Framework\v4.0\Fsi.exe" PostRelease.fsx
pause
:: Remove the temporary drive letter and return to your original location
popd
ScottHutchinson commented 5 years ago

I replaced the folder path with C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\FSharp and that fixed it. Is there some solution that does not assume nobody will move the fsi.exe file again? Please just stop moving my cheese! :O)

isaacabraham commented 5 years ago

Yeah, it's kind of whack-a-mole. To be honest I'm not sure what the best solution is really - I was trying to call FSI from within a Fake script last week and found it tough going within devops.