-
-
Notifications
You must be signed in to change notification settings - Fork 34
/
build-visualstudio.ps1
64 lines (49 loc) · 2.85 KB
/
build-visualstudio.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
[cmdletbinding()]
param(
[Parameter(Mandatory=$False)][ValidateSet('Release','Debug')][string]$configuration
)
# Visual Studio Extensions
# How to run: .\build.ps1 or .\build.ps1 -configuration Debug
. .\build-include.ps1
$scriptpath = $MyInvocation.MyCommand.Path
$dir = Split-Path $scriptpath
Push-Location $dir
if (-not $PSBoundParameters.ContainsKey('configuration'))
{
#if (Test-Path Release.snk) { $configuration = "Release"; } else { $configuration = "Debug"; }
$configuration = "Debug"
}
Write-Host "Using configuration $configuration..." -ForegroundColor Yellow
try {
# This component is hard to debug (fragile dependencies) so it's better to clean on each build
Get-ChildItem .\VisualStudio\ -Recurse | Where{$_.FullName -CMatch ".*\\bin$" -and $_.PSIsContainer} | Remove-Item -Recurse -Force -ErrorAction Ignore
Get-ChildItem .\VisualStudio\ -Recurse | Where{$_.FullName -CMatch ".*\\obj$" -and $_.PSIsContainer} | Remove-Item -Recurse -Force -ErrorAction Ignore
Get-ChildItem .\VisualStudio\ -Recurse | Where{$_.FullName -Match ".*\\obj\\.*project.assets.json$"} | Remove-Item
# CodegenCS.Runtime.VisualStudio
dotnet restore ".\VisualStudio\CodegenCS.Runtime.VisualStudio\CodegenCS.Runtime.VisualStudio.csproj"
& $msbuild ".\VisualStudio\CodegenCS.Runtime.VisualStudio\CodegenCS.Runtime.VisualStudio.csproj" `
/t:Restore /t:Build `
/p:Configuration=$configuration `
/p:IncludeSymbols=true `
/verbosity:minimal `
/p:ContinuousIntegrationBuild=true
if (! $?) { throw "msbuild failed" }
dotnet restore ".\VisualStudio\VS2022Extension\VS2022Extension.csproj"
& $msbuild ".\VisualStudio\VS2022Extension\VS2022Extension.csproj" `
/t:Restore /t:Build `
/p:Configuration=$configuration
if (! $?) { throw "msbuild failed" }
copy .\VisualStudio\VS2022Extension\bin\$configuration\CodegenCS.VisualStudio.VS2022Extension.vsix .\packages-local\
dotnet restore ".\VisualStudio\VS2022Extension\VS2019Extension.csproj"
& $msbuild ".\VisualStudio\VS2019Extension\VS2019Extension.csproj" `
/t:Restore /t:Build `
/p:Configuration=$configuration
if (! $?) { throw "msbuild failed" }
copy .\VisualStudio\VS2019Extension\bin\$configuration\CodegenCS.VisualStudio.VS2019Extension.vsix .\packages-local\
# The secret to VSIX painless-troubleshooting is inspecting the VSIX package:
# & "C:\Program Files\7-Zip\7zFM.exe" .\VisualStudio\VS2022Extension\bin\Debug\CodegenCS.VSExtensions.VisualStudio2022.vsix
# Sometimes command-line shows errors that Visual Studio ignores
# Sometimes in the extension folder we will have ZERO-bytes files
} finally {
Pop-Location
}