mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Clean up build script; use absolute paths and auto-find msbuild
This commit is contained in:
41
build.ps1
41
build.ps1
@@ -1,38 +1,45 @@
|
||||
# search for msbuild, the loaction of vswhere is guarenteed to be consistent
|
||||
$MSBuildPath = (&"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -prerelease -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe) | Out-String
|
||||
$MSBuildPath = $MSBuildPath.Trim();
|
||||
|
||||
# Stop the script if an error occurs
|
||||
$ErrorActionPreference = "Stop"
|
||||
$In = ".\build\Release\"
|
||||
$Out = ".\build\publish\"
|
||||
$Folders = @("./build", "./packages", "./test/bin", "./test/obj")
|
||||
$In = "$PSScriptRoot\build\Release\"
|
||||
$Out = "$PSScriptRoot\build\publish\"
|
||||
$Folders = @("$PSScriptRoot\build", "$PSScriptRoot\packages", "$PSScriptRoot\test\bin", "$PSScriptRoot\test\obj")
|
||||
|
||||
# Ensure a clean state by removing build/package folders
|
||||
foreach ($Folder in $Folders) {
|
||||
if (Test-Path $Folder) {
|
||||
Remove-Item -path $Folder -Recurse -Force
|
||||
Remove-Item -path "$Folder" -Recurse -Force
|
||||
}
|
||||
}
|
||||
|
||||
# Build Squirrel C++ and library files
|
||||
msbuild /verbosity:minimal /restore /p:Configuration=Release
|
||||
# Build Squirrel C++ with msbuild as dotnet can't
|
||||
&"$MSBuildPath" /verbosity:minimal /restore /p:Configuration=Release
|
||||
|
||||
# Build single-exe packaged projects
|
||||
dotnet publish -v minimal -c Release src\Update\Update.csproj -o $Out
|
||||
dotnet publish -v minimal -c Release src\SyncReleases\SyncReleases.csproj -o $Out
|
||||
dotnet publish -v minimal -c Release "$PSScriptRoot\src\Update\Update.csproj" -o "$Out"
|
||||
dotnet publish -v minimal -c Release "$PSScriptRoot\src\SyncReleases\SyncReleases.csproj" -o "$Out"
|
||||
|
||||
# Copy over all files we need
|
||||
Move-Item "$Out\Update.exe" -Destination "$Out\Squirrel.exe"
|
||||
Move-Item "$Out\Update.com" -Destination "$Out\Squirrel.com"
|
||||
|
||||
# Move-Item "$Out\Update.pdb" -Destination "$Out\Squirrel.pdb"
|
||||
# New-Item -Path "$Out\lib" -ItemType "directory" | Out-Null
|
||||
# Copy-Item -Path "$In\netstandard2.0\*" -Destination "$Out\lib" -Recurse
|
||||
|
||||
New-Item -Path "$Out\lib" -ItemType "directory" | Out-Null
|
||||
Copy-Item -Path "$In\netstandard2.0\*" -Destination "$Out\lib" -Recurse
|
||||
Copy-Item "$In\Win32\Setup.exe" -Destination "$Out"
|
||||
Copy-Item "$In\Win32\Setup.pdb" -Destination "$Out"
|
||||
Copy-Item "$In\Win32\StubExecutable.exe" -Destination "$Out"
|
||||
Copy-Item "$In\Win32\WriteZipToSetup.exe" -Destination "$Out"
|
||||
Copy-Item "$In\Win32\WriteZipToSetup.pdb" -Destination "$Out"
|
||||
|
||||
Copy-Item "$In\Win32\Setup.exe" -Destination $Out
|
||||
Copy-Item "$In\Win32\Setup.pdb" -Destination $Out
|
||||
Copy-Item "$In\Win32\StubExecutable.exe" -Destination $Out
|
||||
Copy-Item "$In\Win32\WriteZipToSetup.exe" -Destination $Out
|
||||
Copy-Item "$In\Win32\WriteZipToSetup.pdb" -Destination $Out
|
||||
Copy-Item -Path "$PSScriptRoot\vendor\7zip\*" -Destination "$Out" -Recurse
|
||||
# Copy-Item -Path "$PSScriptRoot\vendor\wix\*" -Destination "$Out" -Recurse
|
||||
Copy-Item "$PSScriptRoot\.nuget\NuGet.exe" -Destination "$Out"
|
||||
|
||||
Copy-Item -Path ".\vendor\7zip\*" -Destination $Out -Recurse
|
||||
# Copy-Item -Path ".\vendor\wix\*" -Destination $Out -Recurse
|
||||
Remove-Item "$Out\*.pdb"
|
||||
|
||||
Write-Output "Successfully copied files to './build/publish'"
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user