diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd708d87..9e940a5d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,7 +70,7 @@ jobs: with: fetch-depth: 0 - name: Install dependencies - run: choco install GitVersion.Portable ilmerge --confirm --no-progress + run: choco install GitVersion.Portable ilmerge il-repack --confirm --no-progress - name: Update project version run: gitversion /l console /output buildserver /updateAssemblyInfo /verbosity minimal - name: Get project version diff --git a/build/00-prerequisites.ps1 b/build/00-prerequisites.ps1 index dc24a59a..7b7a6477 100644 --- a/build/00-prerequisites.ps1 +++ b/build/00-prerequisites.ps1 @@ -1,4 +1,4 @@ -choco install ilmerge +choco install il-repack choco install GitVersion.Portable choco install wixtoolset choco install hub diff --git a/build/01-build.ps1 b/build/01-build.ps1 index 286036fc..1c5b60ba 100644 --- a/build/01-build.ps1 +++ b/build/01-build.ps1 @@ -9,6 +9,16 @@ dotnet publish .\src\gsudo\gsudo.csproj -c Release -o .\artifacts\x64 -f net7 dotnet publish .\src\gsudo\gsudo.csproj -c Release -o .\artifacts\x86 -f net7.0 -r win-x86 --sc -p:PublishReadyToRun=true -p:PublishSingleFile=true -v minimal -p:WarningLevel=0 || $(exit $LASTEXITCODE) "-- Building net4.6 AnyCpu" dotnet publish .\src\gsudo\gsudo.csproj -c Release -o .\artifacts\net46-AnyCpu\unmerged -f net46 -p:Platform=AnyCpu -v minimal -p:WarningLevel=0 || $(exit $LASTEXITCODE) + +"-- Repacking net4.6 AnyCpu into a single EXE" + +ilrepack .\artifacts\net46-AnyCpu\unmerged\gsudo.exe .\artifacts\net46-AnyCpu\unmerged\*.dll /out:.\artifacts\net46-AnyCpu\gsudo.exe /target:exe /targetplatform:v4 /ndebug /wildcards || $(exit $LASTEXITCODE) + +if ($?) { + rm artifacts\net46-AnyCpu\unmerged -Recurse + echo "artifacts\net46-AnyCpu\unmerged -> ilmerge -> artifacts\net46-AnyCpu\" +} + cp .\src\gsudo.Wrappers\* .\artifacts\x86 cp .\src\gsudo.Wrappers\* .\artifacts\x64 cp .\src\gsudo.Wrappers\* .\artifacts\arm64