AAD.fs icon indicating copy to clipboard operation
AAD.fs copied to clipboard

fake -t registerSample throws `Win32Exception: The system cannot find the file specified`

Open fbehrens opened this issue 4 years ago • 3 comments

I am getting the same error on two win10 PCs.

More verbosity does not give me more information

PS C:\code\azure\AAD.fs> dotnet fake build -t registerSample
...
Starting target 'registerSample'
.> "az" account show --query tenantId --output tsv (In: false, Out: true, Err: true)
---------------------------------------------------------------------
Script reported an error:
-> BuildFailedException: Target 'registerSample' failed.
-> One or more errors occurred. (Start of process 'az' failed.)
-> Start of process 'az' failed.
-> Win32Exception: The system cannot find the file specified

PS C:\code\azure\AAD.fs> az --version
azure-cli                         2.27.0
Your CLI is up-to-date.

PS C:\code\azure\AAD.fs> az account show --query tenantId --output tsv
e04f0ef7-9398-4c7e-b22d-df1496f3ad32

> dotnet --version # tried both
3.1.401 [C:\Program Files\dotnet\sdk]
5.0.302 [C:\Program Files\dotnet\sdk]

fbehrens avatar Aug 04 '21 19:08 fbehrens

Thanks, I haven't tried it on Windows, I'm guessing "az" is called something else on Windows, like "az.bat" or some such. I'll check.

et1975 avatar Sep 28 '21 17:09 et1975

I have looked into it and "it looked" like az.cmd is the excecutable on windows, and looks

@IF EXIST "%~dp0\..\python.exe" (
  SET AZ_INSTALLER=MSI
  "%~dp0\..\python.exe" -IBm azure.cli %*
) ELSE (
  echo Failed to load python executable.
  exit /b 1
)

It is calling a vendored python.exe which is addressed relative to the az.cmd file via %~dp0.

The latter does not work with the Fake.Core.CreateProcess used here

However

fbehrens avatar Sep 28 '21 19:09 fbehrens

hm, yeah... so just calling "az.cmd" doesn't work either. Bummer, guess we'll have to find another way to start it.

et1975 avatar Sep 29 '21 13:09 et1975