-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathrun-all.ps1
26 lines (22 loc) · 1.06 KB
/
run-all.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$csprojFiles = Get-ChildItem -Path . -Filter *.csproj
foreach ($file in $csprojFiles) {
$projectName = $file.BaseName
# Run dotnet run for each project and redirect output to a text file named after the project
dotnet run --project $file.FullName | Out-File "${projectName}.output.txt" -Encoding UTF8
# Pad the file with newlines to match the source length
# $sourceFilePath = "${projectName}.cs"
# if (Test-Path $sourceFilePath) {
# $sourceFileLineCount = (Get-Content $sourceFilePath).Count
# $outputFileLineCount = (Get-Content "${projectName}.output.txt").Count
#
# $linesToAdd = $sourceFileLineCount - $outputFileLineCount - 1
#
# for ($i = 0; $i -lt $linesToAdd; $i++) {
# Add-Content -Path "${projectName}.output.txt" -Value ""
# }
# Add-Content -Path "${projectName}.output.txt" -Value "🦊"
# }
# else {
# Write-Warning "Source file ${sourceFilePath} not found. Skipping line padding for ${projectName}."
# }
}