Skip to content

Fix the :add-package command by not using variable parsing from .\build.ps1 - #671

Open
ITaluone wants to merge 3 commits into
Fallout-build:developfrom
ITaluone:fix/add-package-command
Open

ITaluone wants to merge 3 commits into
Fallout-build:developfrom
ITaluone:fix/add-package-command

Conversation

@ITaluone

@ITaluone ITaluone commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

The Join-Path actually prevents to use the gloabl tool's :add-package command, since this command greps the build.csproj path from the .\build.ps1. ./build.sh is not affected, since there is no such "fancy" command to "just" join paths :).

Fixes: #670

@ITaluone
ITaluone requested a review from a team as a code owner September 10, 2026 12:59
@ITaluone ITaluone changed the title Fix the powershell script by not using Join-Path Fix the :add-package command by not using Join-Path in .\build.ps1 Sep 10, 2026
@ITaluone
ITaluone force-pushed the fix/add-package-command branch 2 times, most recently from 7ae0b69 to e994fcf Compare September 10, 2026 13:15

@ChrisonSimtian ChrisonSimtian left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah this old chestnut ... io ops in ps1 is a massive pain, thanks for fixing this

@ChrisonSimtian ChrisonSimtian added bug Something isn't working Can Merge These PRs are just waiting to be merged, nothing more to do and maintainer has approved labels Sep 10, 2026
@ITaluone

Copy link
Copy Markdown
Contributor Author

ah this old chestnut

Why old? I reverted to the actually "old" ;)

@ChrisonSimtian

Copy link
Copy Markdown
Collaborator

ah we use psake at work and the amount of times i fixed this is countless 😂🙈 thats why its an old cheatnut for me. I find this and other things in powershell very brittle, the only advantage over bash is it can natively use dotnet code

@ITaluone

Copy link
Copy Markdown
Contributor Author

I hate powershell as well :)

For example: simple tools like curl regularly freaking me out, because it is a pain on powershell (which is the "default" terminal on win11). Using good old cmd works like a charm :D

@ITaluone

ITaluone commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Ah.. just read the commit message for 7a30bc5.

I try if this is a problem again.

Edit: I tried with forward slashes on windows, for PS v5.1 and PS v7.6.6.. Both worked, and could handle the forward slashes.
I assume this works on unix, too. (I actually cannot imagine why using pwsh on unix since bash is better.. but ok..)

Comment thread src/Fallout.Cli/templates/build.ps1 Outdated
Comment thread src/Fallout.Cli/templates/build.ps1 Outdated
Comment thread build.ps1 Outdated
Comment thread build.ps1 Outdated
@ChrisonSimtian

Copy link
Copy Markdown
Collaborator

Ah.. just read the commit message for 7a30bc5.

gotcha, might just have to try and tell ps1 to use the latest v7 not the legacy v5
iirc then MS actually wants to retire it (same as net framework) but keep it semi-alive for legacy reasons.

which is the "default" terminal on win11
man I feel so much better since I use a macbook as my personal device and run WSL on my win11 work laptop (thanks to claude cli being crap on windows pty :-) ) I even run a LXC on my homelab just for coding. But then energy prices in NZ are not even half of what I used to pay in Germany 10 years ago (and those went up by now by what factor 2?)

@ITaluone

Copy link
Copy Markdown
Contributor Author

@ChrisonSimtian Why the powershell $BuildProjectFile = "$PSScriptRoot/build/_build.csproj" is missing in this repo completely? This is needed for the :add-package command.

@ChrisonSimtian

Copy link
Copy Markdown
Collaborator

@ChrisonSimtian Why the powershell $BuildProjectFile = "$PSScriptRoot/build/_build.csproj" is missing in this repo completely? This is needed for the :add-package command.

$BuildProjectFile = "$PSScriptRoot/_BUILD_DIRECTORY_/_BUILD_PROJECT_NAME_.csproj"
isnt that what you're adding here?

@ITaluone

ITaluone commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

No? that's the template.

I am adding this there, because consumer need it.

I asked why this repo doesn't have this in the .\build.ps1 (aka was removed intentionally?)

Edit: PR #204 removed this, from the template as well as from the "own" .\build.ps1

@ChrisonSimtian

Copy link
Copy Markdown
Collaborator

Edit: PR #204 removed this, from the template as well as from the "own" .\build.ps1

correct, and replaced it with the cli call instead in an attempt to make the powershell script as thin as possible.
the linux version is the same btw.

I dont mind you adding it back if its needed but ultimately i'd really like to move away from .ps1 and .sh towards a pure dotnet cli. So its probably better to build that in natively rather than relying on ps1/sh to pass things through

@ITaluone

ITaluone commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

Ok then.. should this be a follow-up? or should I change the PR to not depend on the bootstrapper files at all?

Your call @ChrisonSimtian

Edit: The problem is, that the user can name the build project file and folder like he wants. We only give a suggestions as default.
So, as long as the user can choose own names we have to write this names somewhere down. And having yet another file for this mapping, I cannot see the advantage compared to what used to work.

@ITaluone

Copy link
Copy Markdown
Contributor Author

Ok.. think I have a solution to this:

A Fallout build project always have this custom MSBuild variables set like: <FalloutRootDirectory> or <FalloutScriptDirectory>.

I will change the AddPackageCommand to basically make a grep -R FalloutRootDirectory *.csproj. If you want, I can introduce a dedicated variable like <IsFalloutBuildProject> or similar.

@ITaluone
ITaluone force-pushed the fix/add-package-command branch from 395f4e2 to 2d22b01 Compare September 17, 2026 09:48
@ITaluone
ITaluone force-pushed the fix/add-package-command branch from 2d22b01 to 0a5a191 Compare September 17, 2026 09:50
@ITaluone ITaluone changed the title Fix the :add-package command by not using Join-Path in .\build.ps1 Fix the :add-package command by not using variable parsing from .\build.ps1 Sep 17, 2026
Comment thread src/Fallout.Cli/templates/build.ps1 Outdated
Comment thread src/Fallout.Cli/templates/build.ps1 Outdated
Comment thread build.ps1 Outdated
Comment thread build.ps1 Outdated
@ChrisonSimtian

Copy link
Copy Markdown
Collaborator

Ok.. think I have a solution to this:

A Fallout build project always have this custom MSBuild variables set like: <FalloutRootDirectory> or <FalloutScriptDirectory>.

I will change the AddPackageCommand to basically make a grep -R FalloutRootDirectory *.csproj. If you want, I can introduce a dedicated variable like <IsFalloutBuildProject> or similar.

lets make a gh issue for this and discuss there independently from this PR. Not in the right headspace for this at the moment, sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Can Merge These PRs are just waiting to be merged, nothing more to do and maintainer has approved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.\build.ps1 in its current state isn't capable for :add-package command

2 participants