22# Licensed under the MIT License. See the LICENSE.
33
44param (
5- [string ]$Branch = " " ,
5+ [string ]$Branch = " " , # This has to correspond with one of the AppEnvironment enum values
66 [string ]$PackageManifestPath = " " ,
77 [string ]$Publisher = " " ,
88 [string ]$WorkingDir = " " ,
@@ -28,10 +28,26 @@ if ($Branch -eq "SideloadPreview")
2828 (Get-Content $_ - Raw | ForEach-Object - Process { $_ -replace " Assets\\AppTiles\\Dev" , " Assets\AppTiles\Preview" }) | `
2929 Set-Content $_ - NoNewline `
3030 }
31+ }
32+ elseif ($Branch -eq " StorePreview" )
33+ {
34+ # Set identities
35+ $xmlDoc.Package.Identity.Name = " 49306atecsolution.FilesPreview"
36+ $xmlDoc.Package.Properties.DisplayName = " Files - Preview"
37+ $xmlDoc.Package.Applications.Application.VisualElements.DisplayName = " Files - Preview"
38+ $xmlDoc.Package.Applications.Application.VisualElements.DefaultTile.ShortName = " 49306atecsolution.FilesPreview"
3139
32- Get-ChildItem $WorkingDir - Include * .cs - recurse | ForEach-Object - Process `
40+ # Remove an capability that is used for the sideload
41+ $nsmgr = New-Object System.Xml.XmlNamespaceManager($xmlDoc.NameTable )
42+ $nsmgr.AddNamespace (" pkg" , " http://schemas.microsoft.com/appx/manifest/foundation/windows10" )
43+ $nsmgr.AddNamespace (" rescap" , " http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" )
44+ $pm = $xmlDoc.SelectSingleNode (" /pkg:Package/pkg:Capabilities/rescap:Capability[@Name='packageManagement']" , $nsmgr )
45+ $xmlDoc.Package.Capabilities.RemoveChild ($pm )
46+ $xmlDoc.Save ($PackageManifestPath )
47+
48+ Get-ChildItem $WorkingDir - Include * .csproj, * .appxmanifest, * .wapproj, * .xaml - recurse | ForEach-Object - Process `
3349 { `
34- (Get-Content $_ - Raw | ForEach-Object - Process { $_ -replace " cd_app_env_placeholder " , " SideloadPreview " }) | `
50+ (Get-Content $_ - Raw | ForEach-Object - Process { $_ -replace " Assets\\AppTiles\\Dev " , " Assets\AppTiles\Preview " }) | `
3551 Set-Content $_ - NoNewline `
3652 }
3753}
@@ -49,12 +65,6 @@ elseif ($Branch -eq "SideloadStable")
4965 (Get-Content $_ - Raw | ForEach-Object - Process { $_ -replace " Assets\\AppTiles\\Dev" , " Assets\AppTiles\Release" }) | `
5066 Set-Content $_ - NoNewline `
5167 }
52-
53- Get-ChildItem $WorkingDir - Include * .cs - recurse | ForEach-Object - Process `
54- { `
55- (Get-Content $_ - Raw | ForEach-Object - Process { $_ -replace " cd_app_env_placeholder" , " SideloadStable" }) | `
56- Set-Content $_ - NoNewline `
57- }
5868}
5969elseif ($Branch -eq " StoreStable" )
6070{
@@ -77,40 +87,12 @@ elseif ($Branch -eq "StoreStable")
7787 (Get-Content $_ - Raw | ForEach-Object - Process { $_ -replace " Assets\\AppTiles\\Dev" , " Assets\AppTiles\Release" }) | `
7888 Set-Content $_ - NoNewline `
7989 }
80-
81- Get-ChildItem $WorkingDir - Include * .cs - recurse | ForEach-Object - Process `
82- { `
83- (Get-Content $_ - Raw | ForEach-Object - Process { $_ -replace " cd_app_env_placeholder" , " StoreStable" }) | `
84- Set-Content $_ - NoNewline `
85- }
8690}
87- elseif ($Branch -eq " StorePreview" )
88- {
89- # Set identities
90- $xmlDoc.Package.Identity.Name = " 49306atecsolution.FilesPreview"
91- $xmlDoc.Package.Properties.DisplayName = " Files - Preview"
92- $xmlDoc.Package.Applications.Application.VisualElements.DisplayName = " Files - Preview"
93- $xmlDoc.Package.Applications.Application.VisualElements.DefaultTile.ShortName = " 49306atecsolution.FilesPreview"
94-
95- # Remove an capability that is used for the sideload
96- $nsmgr = New-Object System.Xml.XmlNamespaceManager($xmlDoc.NameTable )
97- $nsmgr.AddNamespace (" pkg" , " http://schemas.microsoft.com/appx/manifest/foundation/windows10" )
98- $nsmgr.AddNamespace (" rescap" , " http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" )
99- $pm = $xmlDoc.SelectSingleNode (" /pkg:Package/pkg:Capabilities/rescap:Capability[@Name='packageManagement']" , $nsmgr )
100- $xmlDoc.Package.Capabilities.RemoveChild ($pm )
101- $xmlDoc.Save ($PackageManifestPath )
102-
103- Get-ChildItem $WorkingDir - Include * .csproj, * .appxmanifest, * .wapproj, * .xaml - recurse | ForEach-Object - Process `
104- { `
105- (Get-Content $_ - Raw | ForEach-Object - Process { $_ -replace " Assets\\AppTiles\\Dev" , " Assets\AppTiles\Preview" }) | `
106- Set-Content $_ - NoNewline `
107- }
10891
109- Get-ChildItem $WorkingDir - Include * .cs - recurse | ForEach-Object - Process `
110- { `
111- (Get-Content $_ - Raw | ForEach-Object - Process { $_ -replace " cd_app_env_placeholder" , " StorePreview" }) | `
112- Set-Content $_ - NoNewline `
113- }
92+ Get-ChildItem $WorkingDir - Include * .cs - recurse | ForEach-Object - Process `
93+ { `
94+ (Get-Content $_ - Raw | ForEach-Object - Process { $_ -replace " cd_app_env_placeholder" , $Branch }) | `
95+ Set-Content $_ - NoNewline `
11496}
11597
11698Get-ChildItem $WorkingDir - Include * .cs - recurse | ForEach-Object - Process `
0 commit comments