@@ -11,7 +11,20 @@ param(
1111 [string ]$SecretGitHubOAuthClientId = " "
1212)
1313
14+ # Load Package.appxmanifest
1415[xml ]$xmlDoc = Get-Content $PackageManifestPath
16+
17+ # Add namespaces
18+ $nsmgr = New-Object System.Xml.XmlNamespaceManager($xmlDoc.NameTable )
19+ $nsmgr.AddNamespace (" pkg" , " http://schemas.microsoft.com/appx/manifest/foundation/windows10" )
20+ $nsmgr.AddNamespace (" rescap" , " http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" )
21+ $nsmgr.AddNamespace (" uap" , " http://schemas.microsoft.com/appx/manifest/uap/windows10" )
22+ $nsmgr.AddNamespace (" uap5" , " http://schemas.microsoft.com/appx/manifest/uap/windows10/5" )
23+ $ap = $xmlDoc.SelectSingleNode (" /pkg:Package/pkg:Applications/pkg:Application/pkg:Extensions/uap:Extension[@Category='windows.protocol']/uap:Protocol" , $nsmgr )
24+ $aea = $xmlDoc.SelectSingleNode (" /pkg:Package/pkg:Applications/pkg:Application/pkg:Extensions/uap5:Extension[@Category='windows.appExecutionAlias']/uap5:AppExecutionAlias" , $nsmgr )
25+ $ea = $xmlDoc.SelectSingleNode (" /pkg:Package/pkg:Applications/pkg:Application/pkg:Extensions/uap5:Extension[@Category='windows.appExecutionAlias']/uap5:AppExecutionAlias/uap5:ExecutionAlias" , $nsmgr )
26+
27+ # Update the publisher
1528$xmlDoc.Package.Identity.Publisher = $Publisher
1629
1730if ($Branch -eq " Preview" )
@@ -21,13 +34,25 @@ if ($Branch -eq "Preview")
2134 $xmlDoc.Package.Properties.DisplayName = " Files - Preview"
2235 $xmlDoc.Package.Applications.Application.VisualElements.DisplayName = " Files - Preview"
2336 $xmlDoc.Package.Applications.Application.VisualElements.DefaultTile.ShortName = " Files - Preview"
37+
38+ # Update app protocol and execution alias
39+ $ap.SetAttribute (" Name" , " files-preview" );
40+ $ea.SetAttribute (" Alias" , " files-preview.exe" );
41+
42+ # Save modified Package.appxmanifest
2443 $xmlDoc.Save ($PackageManifestPath )
2544
2645 Get-ChildItem $WorkingDir - Include * .csproj, * .appxmanifest, * .wapproj, * .xaml - recurse | ForEach-Object - Process `
2746 { `
2847 (Get-Content $_ - Raw | ForEach-Object - Process { $_ -replace " Assets\\AppTiles\\Dev" , " Assets\AppTiles\Preview" }) | `
2948 Set-Content $_ - NoNewline `
3049 }
50+
51+ Get-ChildItem $WorkingDir - Include * .cs, * .cpp - recurse | ForEach-Object - Process `
52+ { `
53+ (Get-Content $_ - Raw | ForEach-Object - Process { $_ -replace " files-dev" , " files-preview" }) | `
54+ Set-Content $_ - NoNewline `
55+ }
3156}
3257elseif ($Branch -eq " Stable" )
3358{
@@ -36,13 +61,25 @@ elseif ($Branch -eq "Stable")
3661 $xmlDoc.Package.Properties.DisplayName = " Files"
3762 $xmlDoc.Package.Applications.Application.VisualElements.DisplayName = " Files"
3863 $xmlDoc.Package.Applications.Application.VisualElements.DefaultTile.ShortName = " Files"
64+
65+ # Update app protocol and execution alias
66+ $ap.SetAttribute (" Name" , " files-stable" );
67+ $ea.SetAttribute (" Alias" , " files-stable.exe" );
68+
69+ # Save modified Package.appxmanifest
3970 $xmlDoc.Save ($PackageManifestPath )
4071
4172 Get-ChildItem $WorkingDir - Include * .csproj, * .appxmanifest, * .wapproj, * .xaml - recurse | ForEach-Object - Process `
4273 { `
4374 (Get-Content $_ - Raw | ForEach-Object - Process { $_ -replace " Assets\\AppTiles\\Dev" , " Assets\AppTiles\Release" }) | `
4475 Set-Content $_ - NoNewline `
4576 }
77+
78+ Get-ChildItem $WorkingDir - Include * .cs, * .cpp - recurse | ForEach-Object - Process `
79+ { `
80+ (Get-Content $_ - Raw | ForEach-Object - Process { $_ -replace " files-dev" , " files-stable" }) | `
81+ Set-Content $_ - NoNewline `
82+ }
4683}
4784elseif ($Branch -eq " Store" )
4885{
@@ -52,19 +89,28 @@ elseif ($Branch -eq "Store")
5289 $xmlDoc.Package.Applications.Application.VisualElements.DisplayName = " Files"
5390 $xmlDoc.Package.Applications.Application.VisualElements.DefaultTile.ShortName = " Files"
5491
55- # Remove an capability that is used for the sideload
56- $nsmgr = New-Object System.Xml.XmlNamespaceManager($xmlDoc.NameTable )
57- $nsmgr.AddNamespace (" pkg" , " http://schemas.microsoft.com/appx/manifest/foundation/windows10" )
58- $nsmgr.AddNamespace (" rescap" , " http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" )
92+ # Remove capability that is only used for the sideload package
5993 $pm = $xmlDoc.SelectSingleNode (" /pkg:Package/pkg:Capabilities/rescap:Capability[@Name='packageManagement']" , $nsmgr )
6094 $xmlDoc.Package.Capabilities.RemoveChild ($pm )
95+
96+ # Update app protocol and execution alias
97+ $ap.SetAttribute (" Name" , " files" );
98+ $aea.RemoveChild (aea.FirstChild); # Avoid duplication
99+
100+ # Save modified Package.appxmanifest
61101 $xmlDoc.Save ($PackageManifestPath )
62102
63103 Get-ChildItem $WorkingDir - Include * .csproj, * .appxmanifest, * .wapproj, * .xaml - recurse | ForEach-Object - Process `
64104 { `
65105 (Get-Content $_ - Raw | ForEach-Object - Process { $_ -replace " Assets\\AppTiles\\Dev" , " Assets\AppTiles\Release" }) | `
66106 Set-Content $_ - NoNewline `
67107 }
108+
109+ Get-ChildItem $WorkingDir - Include * .cs, * .cpp - recurse | ForEach-Object - Process `
110+ { `
111+ (Get-Content $_ - Raw | ForEach-Object - Process { $_ -replace " files-dev" , " files" }) | `
112+ Set-Content $_ - NoNewline `
113+ }
68114}
69115
70116Get-ChildItem $WorkingDir - Include * .cs - recurse | ForEach-Object - Process `
0 commit comments