|
2 | 2 | [string]$Platform = "x64",
|
3 | 3 | [string]$Configuration = "debug",
|
4 | 4 | [string]$Version,
|
5 |
| - [string]$ClientId, |
6 |
| - [string]$ClientSecret, |
7 |
| - [string]$BuildStep = "all", |
8 |
| - [string]$AzureBuildingBranch = "main", |
9 | 5 | [switch]$IsAzurePipelineBuild = $false,
|
10 | 6 | [switch]$Help = $false
|
11 | 7 | )
|
@@ -47,76 +43,34 @@ Options:
|
47 | 43 | Exit
|
48 | 44 | }
|
49 | 45 |
|
50 |
| -# Install NuGet Cred Provider |
51 |
| -Invoke-Expression "& { $(irm https://aka.ms/install-artifacts-credprovider.ps1) } -AddNetfx" |
52 |
| - |
53 | 46 | # Root is two levels up from the script location.
|
54 | 47 | $env:Build_RootDirectory = (Get-Item $PSScriptRoot).parent.parent.FullName
|
55 | 48 | $env:Build_Platform = $Platform.ToLower()
|
56 | 49 | $env:Build_Configuration = $Configuration.ToLower()
|
57 |
| -$env:msix_version = build\scripts\CreateBuildInfo.ps1 -Version $Version -IsAzurePipelineBuild $IsAzurePipelineBuild |
58 | 50 | $isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')
|
59 | 51 |
|
60 |
| -# Set GitHub OAuth Client App configuration if build-time parameters are present |
61 |
| -$OAuthConfigFilePath = (Join-Path $env:Build_RootDirectory "src\GitHubExtension\Configuration\OAuthConfiguration.cs") |
62 |
| -if (![string]::IsNullOrWhitespace($ClientId)) { |
63 |
| - (Get-Content $OAuthConfigFilePath).Replace("%BUILD_TIME_GITHUB_CLIENT_ID_PLACEHOLDER%", $ClientId) | Set-Content $OAuthConfigFilePath |
64 |
| -} |
65 |
| -else { |
66 |
| - Write-Host "ClientId not found at Build-time" |
67 |
| -} |
68 |
| - |
69 |
| -if (![string]::IsNullOrWhitespace($ClientSecret)) { |
70 |
| - (Get-Content $OAuthConfigFilePath).Replace("%BUILD_TIME_GITHUB_CLIENT_SECRET_PLACEHOLDER%", $ClientSecret) | Set-Content $OAuthConfigFilePath |
71 |
| -} |
72 |
| -else { |
73 |
| - Write-Host "ClientSecret not found at Build-time" |
74 |
| -} |
75 |
| - |
76 |
| -if ($IsAzurePipelineBuild) { |
77 |
| - Copy-Item (Join-Path $env:Build_RootDirectory "build\nuget.config.internal") -Destination (Join-Path $env:Build_RootDirectory "nuget.config") |
78 |
| -} |
79 |
| - |
80 | 52 | $msbuildPath = &"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -prerelease -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe
|
81 | 53 |
|
82 | 54 | $ErrorActionPreference = "Stop"
|
83 | 55 |
|
84 | 56 | . (Join-Path $env:Build_RootDirectory "build\scripts\CertSignAndInstall.ps1")
|
85 | 57 |
|
86 | 58 | Try {
|
87 |
| - $appxmanifestPath = (Join-Path $env:Build_RootDirectory "GitHubExtension\Package.appxmanifest") |
88 |
| - |
89 |
| - [Reflection.Assembly]::LoadWithPartialName("System.Xml.Linq") |
90 |
| - $xIdentity = [System.Xml.Linq.XName]::Get("{http://schemas.microsoft.com/appx/manifest/foundation/windows10}Identity"); |
91 |
| - |
92 |
| - # Update the appxmanifest |
93 |
| - $appxmanifest = [System.Xml.Linq.XDocument]::Load($appxmanifestPath) |
94 |
| - $appxmanifest.Root.Element($xIdentity).Attribute("Version").Value = $env:msix_version |
95 |
| - $appxmanifest.Save($appxmanifestPath) |
96 |
| - |
97 |
| - $appxPackageDir = (Join-Path $env:Build_RootDirectory "AppxPackages\$configuration") |
98 |
| - $solutionPath = (Join-Path $env:Build_RootDirectory "GitHubExtension.sln") |
99 | 59 | $msbuildArgs = @(
|
100 | 60 | ($solutionPath),
|
101 | 61 | ("/p:platform="+$platform),
|
102 | 62 | ("/p:configuration="+$configuration),
|
103 | 63 | ("/restore"),
|
104 | 64 | ("/binaryLogger:GitHubExtension.$platform.$configuration.binlog"),
|
105 |
| - ("/p:AppxPackageOutput=$appxPackageDir\GitHubExtension-$platform.msix"), |
| 65 | + ("/p:AppxPackageOutput=$appxPackageDir\GitHubExtension_$configuration" + "_$Version" + "_$platform.msix"), |
106 | 66 | ("/p:AppxPackageSigningEnabled=false"),
|
107 |
| - ("/p:GenerateAppxPackageOnBuild=true"), |
108 |
| - ("/p:BuildRing=$buildRing") |
| 67 | + ("/p:GenerateAppxPackageOnBuild=true") |
109 | 68 | )
|
110 | 69 |
|
111 | 70 | & $msbuildPath $msbuildArgs
|
112 | 71 | if (-not($IsAzurePipelineBuild) -And $isAdmin) {
|
113 |
| - Invoke-SignPackage "$appxPackageDir\GitHubExtension-$platform.msix" |
| 72 | + Invoke-SignPackage "$appxPackageDir\GitHubExtension_$configuration" + "_$Version" + "_$platform.msix" |
114 | 73 | }
|
115 |
| - |
116 |
| - # Reset the appxmanifest to prevent unnecessary code changes |
117 |
| - $appxmanifest = [System.Xml.Linq.XDocument]::Load($appxmanifestPath) |
118 |
| - $appxmanifest.Root.Element($xIdentity).Attribute("Version").Value = "0.0.0.0" |
119 |
| - $appxmanifest.Save($appxmanifestPath) |
120 | 74 | } Catch {
|
121 | 75 | $formatString = "`n{0}`n`n{1}`n`n"
|
122 | 76 | $fields = $_, $_.ScriptStackTrace
|
|
0 commit comments