dotnet tool ib run script by default as powershell. Possible to configure?

#219 · closed · 9 comments

View on GitHub ↗

da9l

I see that one can run build scripts with pwsh under windows using `--pwsh` `dotnet ib --pwsh test` Would it be possible to configure this so that the config can be stored in the repo of the project using ib? I've encountered that powershell might not be able to load some PS modules that works in pwsh which I use as my primary shell on my Windows box. So `Import-Module XYZ` does not work in the nnn.build.ps1 but it works from the pwsh shell I have.

Comments

nightroman

For `ib.cmd` we have this convention, see https://github.com/nightroman/Invoke-Build/tree/main/ib > If the environment variable `pwsh` is defined it is used as `pwsh` by `ib.cmd`. Otherwise, `ib.cmd` uses `powershell`. E.g. I use this because I prefer pwsh, too. Would it be enough for your scenarios, if `dotnet ib` uses this convention as well? FWIW, I think it should, to be more aligned with `ib.cmd`. I'll probably do this in any case.

da9l

Yeah, the pwsh variable could be set in the script starting it. 👍 Den tis 11 juni 2024 17:28Roman Kuzmin ***@***.***> skrev: > For ib.cmd we have this convention, see > https://github.com/nightroman/Invoke-Build/tree/main/ib > > ib.cmd invokes powershell by default or pwsh if the environment > environment pwsh is defined and points to the executable. > > E.g. I use this because I prefer pwsh, too. > > Would it be enough for your scenarios, if dotnet ib uses this convention > as well? > > FWIW, I think it should, to be more aligned with ib.cmd. I'll probably do > this in any case. > > — > Reply to this email directly, view it on GitHub > <https://github.com/nightroman/Invoke-Build/issues/219#issuecomment-2161050208>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AABD23NTXMQOE2OSPXFO26DZG4JRXAVCNFSM6AAAAABJEMHXR2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRRGA2TAMRQHA> > . > You are receiving this because you authored the thread.Message ID: > ***@***.***> >

nightroman

@da9l Please try v5.11.2

da9l

I'll try it tomorrow. Thanks! Den tis 11 juni 2024 19:21Roman Kuzmin ***@***.***> skrev: > @da9l <https://github.com/da9l> Please try v5.11.2 > > — > Reply to this email directly, view it on GitHub > <https://github.com/nightroman/Invoke-Build/issues/219#issuecomment-2161262910>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AABD23IH5ZGGHWW2DWBNR7LZG4WZXAVCNFSM6AAAAABJEMHXR2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRRGI3DEOJRGA> > . > You are receiving this because you were mentioned.Message ID: > ***@***.***> >

nightroman

All right, please let me know how it goes. Fixed in https://github.com/nightroman/Invoke-Build/commit/3facce8e949e185a7a9aff9a73d653e057ce7f21

da9l

I tried it and it works but I need to figure out where the CI:server's pwsh is installed. Might be trivial but using `--pwsh` is almost easier. Thanks for adding the option tho.

nightroman

@da9l I believe you can just do this ```powershell $env:pwsh = 'pwsh' ``` or in cmd ```cmd set pwsh=pwsh ```

da9l

Ah, that's easy enough. I'll try it tomorrow. On Wed, Jun 12, 2024 at 5:06 PM Roman Kuzmin ***@***.***> wrote: > @da9l <https://github.com/da9l> I believe you can just do this > > $env:pwsh = 'pwsh' > > or in cmd > > set pwsh=pwsh > > — > Reply to this email directly, view it on GitHub > <https://github.com/nightroman/Invoke-Build/issues/219#issuecomment-2163278021>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AABD23M35CKATXYF27GUHZTZHBPWNAVCNFSM6AAAAABJEMHXR2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRTGI3TQMBSGE> > . > You are receiving this because you were mentioned.Message ID: > ***@***.***> > -- ***@***.*** ***@***.***> twitter.com/8DH

da9l

Works as a charm! Thanks!