|
6 | 6 |
|
7 | 7 | ## 📸 Screenshot of App Layout |
8 | 8 |
|
9 | | - |
| 9 | + |
| 10 | + |
| 11 | +## Deploy the Sample Packaged App Locally |
| 12 | + |
| 13 | +1. Open `cpp-sample/FilePickersAppSinglePackaged.sln` or `cs-sample/FilePickersAppSinglePackaged.sln` in Visual Studio, right click on the project, select "Package and Publish" > "Create App Package" |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | +2. Select Sideloading > Next |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | +3. Create and Trust your own test certification |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | +4. Create package |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +5. Open the built result |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | +5. Run Install.ps1 in powershell |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | +*Note:* |
| 40 | + |
| 41 | +If encountering error like below: |
| 42 | + |
| 43 | +> Add-AppxPackage: Cannot find path 'C:\FilePickersAppSinglePackaged_1.0.1.0_x64_Debug_Test\Dependencies\x86\Microsoft.VCLibs.x86.Debug.14.00.appx C:\FilePickersAppSinglePackaged_1.0.1.0_x64_Debug_Test\Dependencies\x86\Microsoft.VCLibs.x86.Debug.14.00.Desktop.appx C:\FilePickersAppSinglePackaged_1.0.1.0_x64_Debug_Test\Dependencies\x64\Microsoft.VCLibs.x64.Debug.14.00.appx C:\FilePickersAppSinglePackaged_1.0.1.0_x64_Debug_Test\Dependencies\x64\Microsoft.VCLibs.x64.Debug.14.00.Desktop.appx' because it does not exist. |
| 44 | +
|
| 45 | +Replace lines 483-491 in `Add-AppDevPackage.ps1` with below script and try again: |
| 46 | + |
| 47 | +```ps |
| 48 | +if ($DependencyPackages.FullName.Count -gt 0) |
| 49 | +{ |
| 50 | + Write-Host $UiStrings.DependenciesFound |
| 51 | + $DependencyPackages.FullName |
| 52 | + |
| 53 | +
|
| 54 | + # Install dependencies one by one first |
| 55 | + foreach ($dep in $DependencyPackages.FullName) { |
| 56 | + echo "Installing dependency: $dep" |
| 57 | + try { |
| 58 | + Add-AppxPackage -Path $dep -ForceApplicationShutdown |
| 59 | + echo "Successfully installed: $dep" |
| 60 | + } catch { |
| 61 | + echo "Failed to install dependency: $dep - $($_.Exception.Message)" |
| 62 | + } |
| 63 | + } |
| 64 | + |
| 65 | + # Now install the main package |
| 66 | + echo "Installing main package: $($DeveloperPackagePath.FullName)" |
| 67 | + Add-AppxPackage -Path $DeveloperPackagePath.FullName -ForceApplicationShutdown |
| 68 | +} |
| 69 | +``` |
| 70 | + |
| 71 | +Screenshot of this error: |
| 72 | + |
| 73 | + |
| 74 | +Screenshot of this mitigation: |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | +Once the dependency *.appx files are installed, this project can be smoothly debugged in Visual Studio. |
| 79 | + |
10 | 80 |
|
11 | 81 | ## 🚀 Run |
12 | 82 |
|
13 | | -1. Open `cpp-sample/FilePickersAppSinglePackaged.sln` or `cs-sample/FilePickersAppSinglePackaged.sln` in Visual Studio 2022. |
| 83 | +1. Open `cpp-sample/FilePickersAppSinglePackaged.sln` or `cs-sample/FilePickersAppSinglePackaged.sln` in Visual Studio. |
14 | 84 | 1. Restore NuGet packages and ensure the Windows App SDK 1.8 runtime is installed locally. |
15 | 85 | 1. Build and run. |
16 | 86 |
|
|
0 commit comments