I have a monorepo with multiple solutions, we can see it simplified like this:
- monorepo
|- scripts
| |- script1.ps
|- src
|- projA
| |- projA.csproj
|- projB
In csproj file, I define a post build target to execute a command, from a script located
in scripts directory at the root of the monorepo:
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="pwsh -NoProfile -ExecutionPolicy RemoteSigned -Command "
$root = $(git rev-parse --show-toplevel);
$scriptPath = [System.IO.Path]::Combine($root, 'scripts', 'script1.ps1');
& $scriptPath '$(ProjectDir)$(OutDir)' "" />
</Target>
It fails miserably, but I do not know how to debug this command and I have no clue what is wrong. Any help would be appreciated.