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

Calling DotNet.exec from a script in AzureDevOps starts older version of dotnet command #2651

Open
ds185357 opened this issue Feb 1, 2022 · 1 comment

Comments

@ds185357
Copy link

ds185357 commented Feb 1, 2022

Description

After update to Fake.DotNet.CLI 5.21 and 5.21.1, DotNet.exec command runs from default location instead of the location where dotnet is executed from for fake run.

Repro steps

Having two scripts build.fsx and fantomas.fsx where the former calls the later as shown below:

build.fsx excerpt

Target.create "CheckCodeFormat" (fun _ ->
let r = DotNet.exec id "fake" "run fantomas.fsx -t CheckCodeFormat"
if not r.OK then failwith "fantomas CheckCodeFormat build script failed"
)

fantomas.fsx

Target.create "CheckCodeFormat" (fun _ ->
let checkCodeResult =
filesToCheckCodeOn
|> Seq.map (sprintf ""%s"")
|> String.concat " "
|> sprintf "%s --check"
|> DotNet.exec id "fantomas"

if checkCodeResult.ExitCode = 0 then
    Trace.log "No files need formatting"
elif checkCodeResult.ExitCode = 99 then
    failwith "Some files need formatting, check output for more info"
else
    Trace.logf "Errors while formatting: %A" checkCodeResult.Errors)

Expected behavior

Fantomas should be started by the command below (dotnet located in hostedtoolcache, dotnet 6.0)

D:\a\1\s> "C:\hostedtoolcache\windows/dotnet\dotnet.EXE" fake run fantomas.fsx -t CheckCodeFormat (In: false, Out: false, Err: false)

Actual behavior

Fantomas is started by the command below (dotnet located in Program Files, dotnet 5.0)

D:\a\1\s> "C:\Program Files\dotnet\dotnet.exe" fake run fantomas.fsx -t CheckCodeFormat (In: false, Out: false, Err: false)

Known workarounds

Use Fake.DotNet.CLI < 5.21

Related information

  • Azure DevOps build pipeline
  • Fake.DotNet.CLI >= 5.21
  • .NET Runtime 6.0, SDK 6.0.1
@github-actions
Copy link

github-actions bot commented Feb 1, 2022

Welcome to the FAKE community! Thank you so much for creating your first issue and therefore improving the project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant