Skip to content

Commit

Permalink
MSbuild for vs2022
Browse files Browse the repository at this point in the history
  • Loading branch information
markgibbons25 committed Feb 8, 2022
1 parent e729035 commit 77a8520
Showing 1 changed file with 38 additions and 32 deletions.
70 changes: 38 additions & 32 deletions build/PackageNuGet.ps1
Original file line number Diff line number Diff line change
@@ -1,33 +1,39 @@
param($scriptRoot)

$ErrorActionPreference = "Stop"

function Resolve-MsBuild {
$msb2017 = Resolve-Path "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\*\MSBuild\*\bin\msbuild.exe" -ErrorAction SilentlyContinue
if($msb2017) {
Write-Host "Found MSBuild 2019 (or later)."
Write-Host $msb2017
return $msb2017
}

$msBuild2015 = "${env:ProgramFiles(x86)}\MSBuild\14.0\bin\msbuild.exe"

if(-not (Test-Path $msBuild2015)) {
throw 'Could not find MSBuild 2015 or later.'
}

Write-Host "Found MSBuild 2015."
Write-Host $msBuild2015

return $msBuild2015
}

$msBuild = Resolve-MsBuild
$nuGet = "$scriptRoot..\tools\NuGet.exe"
$solution = "$scriptRoot\..\Dianoga.sln"

& $nuGet restore $solution
& $msBuild $solution /p:Configuration=Release /t:Rebuild /m

& dotnet pack "$scriptRoot\..\src\Dianoga\Dianoga.csproj" -Property:Configuration=Release -o $scriptRoot --include-symbols
param($scriptRoot)

$ErrorActionPreference = "Stop"

function Resolve-MsBuild {
$msb2022 = Resolve-Path "${env:ProgramFiles}\Microsoft Visual Studio\2022\*\MSBuild\*\bin\msbuild.exe" -ErrorAction SilentlyContinue
if($msb2022) {
Write-Host "Found MSBuild 2022 (or later)."
Write-Host $msb2022
return $msb2022
}
$msb2019 = Resolve-Path "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\*\MSBuild\*\bin\msbuild.exe" -ErrorAction SilentlyContinue
if($msb2019) {
Write-Host "Found MSBuild 2019 (or later)."
Write-Host $msb2019
return $msb2019
}

$msBuild2015 = "${env:ProgramFiles(x86)}\MSBuild\14.0\bin\msbuild.exe"

if(-not (Test-Path $msBuild2015)) {
throw 'Could not find MSBuild 2015 or later.'
}

Write-Host "Found MSBuild 2015."
Write-Host $msBuild2015

return $msBuild2015
}

$msBuild = Resolve-MsBuild
$nuGet = "$scriptRoot..\tools\NuGet.exe"
$solution = "$scriptRoot\..\Dianoga.sln"

& $nuGet restore $solution
& $msBuild $solution /p:Configuration=Release /t:Rebuild /m

& dotnet pack "$scriptRoot\..\src\Dianoga\Dianoga.csproj" -Property:Configuration=Release -o $scriptRoot --include-symbols
& $nuGet pack "$scriptRoot\..\src\Dianoga\Dianoga.svgtools.nuspec"

0 comments on commit 77a8520

Please sign in to comment.