├── .gitattributes ├── .github ├── dependabot.yml └── workflows │ └── release.yml ├── .gitignore ├── AppxPackagesManager ├── AppxPackagesManager.sln └── AppxPackagesManager │ ├── App.config │ ├── App.xaml │ ├── App.xaml.cs │ ├── AppxPackagesManager.csproj │ ├── Models │ ├── PackageType.cs │ └── PackagesGridItemModel.cs │ ├── NativeMethods.cs │ ├── PackageInfo.cs │ ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings │ ├── Utils.cs │ ├── ViewModels │ ├── MainViewViewModel.cs │ ├── RelayCommand.cs │ └── ViewModelBase.cs │ ├── Views │ ├── MainView.xaml │ └── MainView.xaml.cs │ └── app.manifest ├── LICENSE ├── README.md └── assets └── img └── program-screenshot.png /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | updates: 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "weekly" 8 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Create release 2 | run-name: Create release 3 | 4 | on: 5 | workflow_dispatch: 6 | inputs: 7 | version: 8 | description: "Version of the program to build. This will be used for the tag and release name." 9 | required: true 10 | 11 | pre-release: 12 | description: "Pre-release" 13 | required: true 14 | default: false 15 | type: boolean 16 | 17 | permissions: 18 | contents: write 19 | 20 | jobs: 21 | build: 22 | runs-on: windows-latest 23 | 24 | steps: 25 | - name: Checkout repository 26 | uses: actions/checkout@v4 27 | 28 | - name: Set up MSVC environment 29 | uses: microsoft/setup-msbuild@v2 30 | 31 | - name: Install packages 32 | run: nuget restore .\AppxPackagesManager\AppxPackagesManager.sln 33 | 34 | - name: Build executable 35 | run: MSBuild.exe .\AppxPackagesManager\AppxPackagesManager.sln -p:Configuration=Release -p:Platform=x64 36 | 37 | - name: Create release 38 | uses: ncipollo/release-action@v1 39 | with: 40 | tag: ${{ inputs.version }} 41 | name: ${{ inputs.version }} 42 | prerelease: ${{ inputs.pre-release }} 43 | artifacts: ./AppxPackagesManager/AppxPackagesManager/bin/x64/Release/AppxPackagesManager.exe 44 | generateReleaseNotes: true 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Ll]og/ 33 | [Ll]ogs/ 34 | 35 | # Visual Studio 2015/2017 cache/options directory 36 | .vs/ 37 | # Uncomment if you have tasks that create the project's static files in wwwroot 38 | #wwwroot/ 39 | 40 | # Visual Studio 2017 auto generated files 41 | Generated\ Files/ 42 | 43 | # MSTest test Results 44 | [Tt]est[Rr]esult*/ 45 | [Bb]uild[Ll]og.* 46 | 47 | # NUnit 48 | *.VisualState.xml 49 | TestResult.xml 50 | nunit-*.xml 51 | 52 | # Build Results of an ATL Project 53 | [Dd]ebugPS/ 54 | [Rr]eleasePS/ 55 | dlldata.c 56 | 57 | # Benchmark Results 58 | BenchmarkDotNet.Artifacts/ 59 | 60 | # .NET 61 | project.lock.json 62 | project.fragment.lock.json 63 | artifacts/ 64 | 65 | # Tye 66 | .tye/ 67 | 68 | # ASP.NET Scaffolding 69 | ScaffoldingReadMe.txt 70 | 71 | # StyleCop 72 | StyleCopReport.xml 73 | 74 | # Files built by Visual Studio 75 | *_i.c 76 | *_p.c 77 | *_h.h 78 | *.ilk 79 | *.meta 80 | *.obj 81 | *.iobj 82 | *.pch 83 | *.pdb 84 | *.ipdb 85 | *.pgc 86 | *.pgd 87 | *.rsp 88 | *.sbr 89 | *.tlb 90 | *.tli 91 | *.tlh 92 | *.tmp 93 | *.tmp_proj 94 | *_wpftmp.csproj 95 | *.log 96 | *.tlog 97 | *.vspscc 98 | *.vssscc 99 | .builds 100 | *.pidb 101 | *.svclog 102 | *.scc 103 | 104 | # Chutzpah Test files 105 | _Chutzpah* 106 | 107 | # Visual C++ cache files 108 | ipch/ 109 | *.aps 110 | *.ncb 111 | *.opendb 112 | *.opensdf 113 | *.sdf 114 | *.cachefile 115 | *.VC.db 116 | *.VC.VC.opendb 117 | 118 | # Visual Studio profiler 119 | *.psess 120 | *.vsp 121 | *.vspx 122 | *.sap 123 | 124 | # Visual Studio Trace Files 125 | *.e2e 126 | 127 | # TFS 2012 Local Workspace 128 | $tf/ 129 | 130 | # Guidance Automation Toolkit 131 | *.gpState 132 | 133 | # ReSharper is a .NET coding add-in 134 | _ReSharper*/ 135 | *.[Rr]e[Ss]harper 136 | *.DotSettings.user 137 | 138 | # TeamCity is a build add-in 139 | _TeamCity* 140 | 141 | # DotCover is a Code Coverage Tool 142 | *.dotCover 143 | 144 | # AxoCover is a Code Coverage Tool 145 | .axoCover/* 146 | !.axoCover/settings.json 147 | 148 | # Coverlet is a free, cross platform Code Coverage Tool 149 | coverage*.json 150 | coverage*.xml 151 | coverage*.info 152 | 153 | # Visual Studio code coverage results 154 | *.coverage 155 | *.coveragexml 156 | 157 | # NCrunch 158 | _NCrunch_* 159 | .*crunch*.local.xml 160 | nCrunchTemp_* 161 | 162 | # MightyMoose 163 | *.mm.* 164 | AutoTest.Net/ 165 | 166 | # Web workbench (sass) 167 | .sass-cache/ 168 | 169 | # Installshield output folder 170 | [Ee]xpress/ 171 | 172 | # DocProject is a documentation generator add-in 173 | DocProject/buildhelp/ 174 | DocProject/Help/*.HxT 175 | DocProject/Help/*.HxC 176 | DocProject/Help/*.hhc 177 | DocProject/Help/*.hhk 178 | DocProject/Help/*.hhp 179 | DocProject/Help/Html2 180 | DocProject/Help/html 181 | 182 | # Click-Once directory 183 | publish/ 184 | 185 | # Publish Web Output 186 | *.[Pp]ublish.xml 187 | *.azurePubxml 188 | # Note: Comment the next line if you want to checkin your web deploy settings, 189 | # but database connection strings (with potential passwords) will be unencrypted 190 | *.pubxml 191 | *.publishproj 192 | 193 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 194 | # checkin your Azure Web App publish settings, but sensitive information contained 195 | # in these scripts will be unencrypted 196 | PublishScripts/ 197 | 198 | # NuGet Packages 199 | *.nupkg 200 | # NuGet Symbol Packages 201 | *.snupkg 202 | # The packages folder can be ignored because of Package Restore 203 | **/[Pp]ackages/* 204 | # except build/, which is used as an MSBuild target. 205 | !**/[Pp]ackages/build/ 206 | # Uncomment if necessary however generally it will be regenerated when needed 207 | #!**/[Pp]ackages/repositories.config 208 | # NuGet v3's project.json files produces more ignorable files 209 | *.nuget.props 210 | *.nuget.targets 211 | 212 | # Microsoft Azure Build Output 213 | csx/ 214 | *.build.csdef 215 | 216 | # Microsoft Azure Emulator 217 | ecf/ 218 | rcf/ 219 | 220 | # Windows Store app package directories and files 221 | AppPackages/ 222 | BundleArtifacts/ 223 | Package.StoreAssociation.xml 224 | _pkginfo.txt 225 | *.appx 226 | *.appxbundle 227 | *.appxupload 228 | 229 | # Visual Studio cache files 230 | # files ending in .cache can be ignored 231 | *.[Cc]ache 232 | # but keep track of directories ending in .cache 233 | !?*.[Cc]ache/ 234 | 235 | # Others 236 | ClientBin/ 237 | ~$* 238 | *~ 239 | *.dbmdl 240 | *.dbproj.schemaview 241 | *.jfm 242 | *.pfx 243 | *.publishsettings 244 | orleans.codegen.cs 245 | 246 | # Including strong name files can present a security risk 247 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 248 | #*.snk 249 | 250 | # Since there are multiple workflows, uncomment next line to ignore bower_components 251 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 252 | #bower_components/ 253 | 254 | # RIA/Silverlight projects 255 | Generated_Code/ 256 | 257 | # Backup & report files from converting an old project file 258 | # to a newer Visual Studio version. Backup files are not needed, 259 | # because we have git ;-) 260 | _UpgradeReport_Files/ 261 | Backup*/ 262 | UpgradeLog*.XML 263 | UpgradeLog*.htm 264 | ServiceFabricBackup/ 265 | *.rptproj.bak 266 | 267 | # SQL Server files 268 | *.mdf 269 | *.ldf 270 | *.ndf 271 | 272 | # Business Intelligence projects 273 | *.rdl.data 274 | *.bim.layout 275 | *.bim_*.settings 276 | *.rptproj.rsuser 277 | *- [Bb]ackup.rdl 278 | *- [Bb]ackup ([0-9]).rdl 279 | *- [Bb]ackup ([0-9][0-9]).rdl 280 | 281 | # Microsoft Fakes 282 | FakesAssemblies/ 283 | 284 | # GhostDoc plugin setting file 285 | *.GhostDoc.xml 286 | 287 | # Node.js Tools for Visual Studio 288 | .ntvs_analysis.dat 289 | node_modules/ 290 | 291 | # Visual Studio 6 build log 292 | *.plg 293 | 294 | # Visual Studio 6 workspace options file 295 | *.opt 296 | 297 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 298 | *.vbw 299 | 300 | # Visual Studio 6 auto-generated project file (contains which files were open etc.) 301 | *.vbp 302 | 303 | # Visual Studio 6 workspace and project file (working project files containing files to include in project) 304 | *.dsw 305 | *.dsp 306 | 307 | # Visual Studio 6 technical files 308 | *.ncb 309 | *.aps 310 | 311 | # Visual Studio LightSwitch build output 312 | **/*.HTMLClient/GeneratedArtifacts 313 | **/*.DesktopClient/GeneratedArtifacts 314 | **/*.DesktopClient/ModelManifest.xml 315 | **/*.Server/GeneratedArtifacts 316 | **/*.Server/ModelManifest.xml 317 | _Pvt_Extensions 318 | 319 | # Paket dependency manager 320 | .paket/paket.exe 321 | paket-files/ 322 | 323 | # FAKE - F# Make 324 | .fake/ 325 | 326 | # CodeRush personal settings 327 | .cr/personal 328 | 329 | # Python Tools for Visual Studio (PTVS) 330 | __pycache__/ 331 | *.pyc 332 | 333 | # Cake - Uncomment if you are using it 334 | # tools/** 335 | # !tools/packages.config 336 | 337 | # Tabs Studio 338 | *.tss 339 | 340 | # Telerik's JustMock configuration file 341 | *.jmconfig 342 | 343 | # BizTalk build output 344 | *.btp.cs 345 | *.btm.cs 346 | *.odx.cs 347 | *.xsd.cs 348 | 349 | # OpenCover UI analysis results 350 | OpenCover/ 351 | 352 | # Azure Stream Analytics local run output 353 | ASALocalRun/ 354 | 355 | # MSBuild Binary and Structured Log 356 | *.binlog 357 | 358 | # NVidia Nsight GPU debugger configuration file 359 | *.nvuser 360 | 361 | # MFractors (Xamarin productivity tool) working folder 362 | .mfractor/ 363 | 364 | # Local History for Visual Studio 365 | .localhistory/ 366 | 367 | # Visual Studio History (VSHistory) files 368 | .vshistory/ 369 | 370 | # BeatPulse healthcheck temp database 371 | healthchecksdb 372 | 373 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 374 | MigrationBackup/ 375 | 376 | # Ionide (cross platform F# VS Code tools) working folder 377 | .ionide/ 378 | 379 | # Fody - auto-generated XML schema 380 | FodyWeavers.xsd 381 | 382 | # VS Code files for those working on multiple tools 383 | .vscode/* 384 | !.vscode/settings.json 385 | !.vscode/tasks.json 386 | !.vscode/launch.json 387 | !.vscode/extensions.json 388 | *.code-workspace 389 | 390 | # Local History for Visual Studio Code 391 | .history/ 392 | 393 | # Windows Installer files from build outputs 394 | *.cab 395 | *.msi 396 | *.msix 397 | *.msm 398 | *.msp 399 | 400 | # JetBrains Rider 401 | *.sln.iml 402 | 403 | ## 404 | ## Visual studio for Mac 405 | ## 406 | 407 | 408 | # globs 409 | Makefile.in 410 | *.userprefs 411 | *.usertasks 412 | config.make 413 | config.status 414 | aclocal.m4 415 | install-sh 416 | autom4te.cache/ 417 | *.tar.gz 418 | tarballs/ 419 | test-results/ 420 | 421 | # Mac bundle stuff 422 | *.dmg 423 | *.app 424 | 425 | # content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore 426 | # General 427 | .DS_Store 428 | .AppleDouble 429 | .LSOverride 430 | 431 | # Icon must end with two \r 432 | Icon 433 | 434 | 435 | # Thumbnails 436 | ._* 437 | 438 | # Files that might appear in the root of a volume 439 | .DocumentRevisions-V100 440 | .fseventsd 441 | .Spotlight-V100 442 | .TemporaryItems 443 | .Trashes 444 | .VolumeIcon.icns 445 | .com.apple.timemachine.donotpresent 446 | 447 | # Directories potentially created on remote AFP share 448 | .AppleDB 449 | .AppleDesktop 450 | Network Trash Folder 451 | Temporary Items 452 | .apdisk 453 | 454 | # content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore 455 | # Windows thumbnail cache files 456 | Thumbs.db 457 | ehthumbs.db 458 | ehthumbs_vista.db 459 | 460 | # Dump file 461 | *.stackdump 462 | 463 | # Folder config file 464 | [Dd]esktop.ini 465 | 466 | # Recycle Bin used on file shares 467 | $RECYCLE.BIN/ 468 | 469 | # Windows Installer files 470 | *.cab 471 | *.msi 472 | *.msix 473 | *.msm 474 | *.msp 475 | 476 | # Windows shortcuts 477 | *.lnk 478 | -------------------------------------------------------------------------------- /AppxPackagesManager/AppxPackagesManager.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.10.35013.160 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppxPackagesManager", "AppxPackagesManager\AppxPackagesManager.csproj", "{6E6CA88B-CBF3-4A36-9D33-9312FC54392E}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {6E6CA88B-CBF3-4A36-9D33-9312FC54392E}.Debug|x64.ActiveCfg = Debug|x64 15 | {6E6CA88B-CBF3-4A36-9D33-9312FC54392E}.Debug|x64.Build.0 = Debug|x64 16 | {6E6CA88B-CBF3-4A36-9D33-9312FC54392E}.Release|x64.ActiveCfg = Release|x64 17 | {6E6CA88B-CBF3-4A36-9D33-9312FC54392E}.Release|x64.Build.0 = Release|x64 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {46C4FC05-2279-4554-9512-E10B3ECB498D} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /AppxPackagesManager/AppxPackagesManager/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /AppxPackagesManager/AppxPackagesManager/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | -------------------------------------------------------------------------------- /AppxPackagesManager/AppxPackagesManager/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace AppxPackagesManager { 4 | /// 5 | /// Interaction logic for App.xaml 6 | /// 7 | public partial class App : Application { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /AppxPackagesManager/AppxPackagesManager/AppxPackagesManager.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {6E6CA88B-CBF3-4A36-9D33-9312FC54392E} 8 | WinExe 9 | AppxPackagesManager 10 | AppxPackagesManager 11 | v4.8 12 | 512 13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 14 | 4 15 | true 16 | true 17 | 18 | 19 | x64 20 | bin\x64\Debug\ 21 | 22 | 23 | x64 24 | bin\x64\Release\ 25 | 26 | 27 | 28 | 29 | 30 | app.manifest 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 4.0 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | MSBuild:Compile 52 | Designer 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | MSBuild:Compile 64 | Designer 65 | 66 | 67 | App.xaml 68 | Code 69 | 70 | 71 | MainView.xaml 72 | Code 73 | 74 | 75 | 76 | 77 | Code 78 | 79 | 80 | True 81 | True 82 | Resources.resx 83 | 84 | 85 | True 86 | Settings.settings 87 | True 88 | 89 | 90 | ResXFileCodeGenerator 91 | Resources.Designer.cs 92 | 93 | 94 | 95 | SettingsSingleFileGenerator 96 | Settings.Designer.cs 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 10.0.26100.1 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /AppxPackagesManager/AppxPackagesManager/Models/PackageType.cs: -------------------------------------------------------------------------------- 1 | namespace AppxPackagesManager.Models { 2 | internal class PackageType { 3 | public static string AllPackages = "All Packages"; 4 | public static string Packages = "Packages"; 5 | public static string NonRemovablePackages = "Non-Removable"; 6 | public static string FrameworkPackages = "Framework"; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /AppxPackagesManager/AppxPackagesManager/Models/PackagesGridItemModel.cs: -------------------------------------------------------------------------------- 1 | using AppxPackagesManager.ViewModels; 2 | using System.Windows; 3 | 4 | namespace AppxPackagesManager.Models { 5 | internal class PackagesGridItemModel : ViewModelBase { 6 | public bool CanUninstall { get; set; } 7 | public string CheckBoxToolTip { get; set; } 8 | 9 | private bool isUninstall; 10 | public bool IsUninstall { 11 | get => isUninstall; 12 | set { 13 | if ( 14 | value && 15 | PackageName != null && // null when program starts 16 | PackageName.ToLower().Contains("windowsstore") && 17 | MessageBox.Show($"Are you sure you want to remove Microsoft Store? It is not recommended as it can be used to install applications in the future", "AppxPackagesManager", MessageBoxButton.YesNo) != MessageBoxResult.Yes) { 18 | return; 19 | } 20 | 21 | isUninstall = value; 22 | OnPropertyChanged(); 23 | } 24 | } 25 | 26 | public string FriendlyName { get; set; } 27 | public string PackageName { get; set; } 28 | public string RequiredByPackages { get; set; } 29 | public string Version { get; set; } 30 | public string IsNonRemovable { get; set; } 31 | public string IsFramework { get; set; } 32 | public string InstallLocation { get; set; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /AppxPackagesManager/AppxPackagesManager/NativeMethods.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace AppxPackagesManager { 4 | internal class NativeMethods { 5 | [DllImport("AppxAllUserStore.dll", CharSet = CharSet.Unicode)] 6 | public static extern int IsPackageFamilyInUninstallBlocklist(string packageFamilyName, ref bool isPresent); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /AppxPackagesManager/AppxPackagesManager/PackageInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace AppxPackagesManager { 5 | internal class PackageInfo { 6 | public string FriendlyName { get; set; } 7 | public HashSet RequiredByPackages { get; set; } 8 | public string Version { get; set; } 9 | public bool IsNonRemovable { get; set; } 10 | public bool IsFramework { get; set; } 11 | public string InstallLocation { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /AppxPackagesManager/AppxPackagesManager/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | using System.Windows; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("AppxPackagesManager")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("AppxPackagesManager")] 13 | [assembly: AssemblyCopyright("Copyright © 2024")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | //In order to begin building localizable applications, set 23 | //CultureYouAreCodingWith in your .csproj file 24 | //inside a . For example, if you are using US english 25 | //in your source files, set the to en-US. Then uncomment 26 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 27 | //the line below to match the UICulture setting in the project file. 28 | 29 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 30 | 31 | 32 | [assembly: ThemeInfo( 33 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 34 | //(used if a resource is not found in the page, 35 | // or application resource dictionaries) 36 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 37 | //(used if a resource is not found in the page, 38 | // app, or any theme specific resource dictionaries) 39 | )] 40 | 41 | 42 | // Version information for an assembly consists of the following four values: 43 | // 44 | // Major Version 45 | // Minor Version 46 | // Build Number 47 | // Revision 48 | // 49 | // You can specify all the values or you can default the Build and Revision Numbers 50 | // by using the '*' as shown below: 51 | // [assembly: AssemblyVersion("1.0.*")] 52 | [assembly: AssemblyVersion("1.4.3.0")] 53 | [assembly: AssemblyFileVersion("1.4.3.0")] 54 | -------------------------------------------------------------------------------- /AppxPackagesManager/AppxPackagesManager/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace AppxPackagesManager.Properties { 12 | 13 | 14 | /// 15 | /// A strongly-typed resource class, for looking up localized strings, etc. 16 | /// 17 | // This class was auto-generated by the StronglyTypedResourceBuilder 18 | // class via a tool like ResGen or Visual Studio. 19 | // To add or remove a member, edit your .ResX file then rerun ResGen 20 | // with the /str option, or rebuild your VS project. 21 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 22 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 23 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 24 | internal class Resources { 25 | 26 | private static global::System.Resources.ResourceManager resourceMan; 27 | 28 | private static global::System.Globalization.CultureInfo resourceCulture; 29 | 30 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 31 | internal Resources() { 32 | } 33 | 34 | /// 35 | /// Returns the cached ResourceManager instance used by this class. 36 | /// 37 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 38 | internal static global::System.Resources.ResourceManager ResourceManager { 39 | get { 40 | if ((resourceMan == null)) { 41 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AppxPackagesManager.Properties.Resources", typeof(Resources).Assembly); 42 | resourceMan = temp; 43 | } 44 | return resourceMan; 45 | } 46 | } 47 | 48 | /// 49 | /// Overrides the current thread's CurrentUICulture property for all 50 | /// resource lookups using this strongly typed resource class. 51 | /// 52 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 53 | internal static global::System.Globalization.CultureInfo Culture { 54 | get { 55 | return resourceCulture; 56 | } 57 | set { 58 | resourceCulture = value; 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /AppxPackagesManager/AppxPackagesManager/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /AppxPackagesManager/AppxPackagesManager/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace AppxPackagesManager.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /AppxPackagesManager/AppxPackagesManager/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /AppxPackagesManager/AppxPackagesManager/Utils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Xml.Linq; 8 | using Windows.ApplicationModel; 9 | using Windows.Foundation; 10 | using Windows.Management.Deployment; 11 | 12 | namespace AppxPackagesManager { 13 | internal class Utils { 14 | private static readonly PackageManager packageManager = new PackageManager(); 15 | private static readonly XNamespace xdocNamespace = "http://schemas.microsoft.com/appx/manifest/foundation/windows10"; 16 | 17 | private static bool IsPackageFamilyInUninstallBlocklist(string packageFamilyName) { 18 | var isPresent = false; 19 | 20 | if (NativeMethods.IsPackageFamilyInUninstallBlocklist(packageFamilyName, ref isPresent) < 0) { 21 | _ = MessageBox.Show($"Failed to determine whether package family {packageFamilyName} is in uninstall blocklist", "AppxPackagesManager", MessageBoxButton.OK, MessageBoxImage.Error); 22 | Environment.Exit(1); 23 | } 24 | 25 | return isPresent; 26 | } 27 | 28 | private static string GetManifestFriendlyName(string manifestLocation) { 29 | var xdoc = XDocument.Load(manifestLocation); 30 | 31 | var displayName = xdoc.Element(xdocNamespace + "Package").Element(xdocNamespace + "Properties").Element(xdocNamespace + "DisplayName").Value; 32 | 33 | return displayName; 34 | } 35 | 36 | private static string GetPackageFriendlyName(Package package) { 37 | var friendlyName = ""; 38 | 39 | try { 40 | friendlyName = package.DisplayName; 41 | } catch { 42 | // ignore as it will be fetched by other means 43 | } 44 | 45 | if (friendlyName == "") { 46 | // attempt to get the friendly name from the manifest 47 | var manifestLocation = $"{package.InstalledLocation.Path}\\AppxManifest.xml"; 48 | 49 | if (File.Exists(manifestLocation)) { 50 | try { 51 | var manifestDisplayName = GetManifestFriendlyName(manifestLocation); 52 | 53 | // ignore invalid display names 54 | if (!manifestDisplayName.StartsWith("ms-resource")) { 55 | friendlyName = manifestDisplayName; 56 | } 57 | } catch (NullReferenceException) { 58 | // ignore 59 | } 60 | } 61 | } 62 | 63 | if (friendlyName == "") { 64 | friendlyName = package.Id.Name; 65 | } 66 | 67 | return friendlyName; 68 | } 69 | 70 | private static void AddPackageToDatabase(Dictionary database, string packageFullName, Package package) { 71 | // add package to database 72 | var packageVersion = package.Id.Version; 73 | 74 | var installLocation = ""; 75 | 76 | try { 77 | installLocation = package.InstalledLocation.Path; 78 | } catch (FileNotFoundException) { 79 | // ignore 80 | } 81 | 82 | database.Add(packageFullName, new PackageInfo { 83 | FriendlyName = GetPackageFriendlyName(package), 84 | RequiredByPackages = new HashSet(), 85 | Version = $"{packageVersion.Major}.{packageVersion.Minor}.{packageVersion.Build}", 86 | IsNonRemovable = package.SignatureKind == PackageSignatureKind.System || IsPackageFamilyInUninstallBlocklist(package.Id.FamilyName), 87 | IsFramework = package.IsFramework, 88 | InstallLocation = installLocation, 89 | }); 90 | } 91 | 92 | public static Dictionary GetPackagesDatabase(bool isAllUsersPackages) { 93 | // holds information for all packages 94 | var packagesDatabase = new Dictionary(); 95 | 96 | var packages = isAllUsersPackages ? packageManager.FindPackages() : packageManager.FindPackagesForUser(""); 97 | 98 | foreach (var package in packages) { 99 | var packageFullName = package.Id.FullName; 100 | 101 | // package may have been added already due to creating dependency entries 102 | if (!packagesDatabase.ContainsKey(packageFullName)) { 103 | AddPackageToDatabase(packagesDatabase, packageFullName, package); 104 | } 105 | 106 | foreach (var dependency in package.Dependencies) { 107 | var dependencyFullName = dependency.Id.FullName; 108 | 109 | // package may have been added already when creating main package entries 110 | if (!packagesDatabase.ContainsKey(dependencyFullName)) { 111 | AddPackageToDatabase(packagesDatabase, dependencyFullName, dependency); 112 | } 113 | 114 | // record that the dependency is needed for another main package 115 | _ = packagesDatabase[dependencyFullName].RequiredByPackages.Add(packageFullName); 116 | } 117 | } 118 | 119 | return packagesDatabase; 120 | } 121 | 122 | public static async Task UninstallPackage(string fullPackageName, bool isAllUsersPackages) { 123 | var removalOptions = isAllUsersPackages ? RemovalOptions.RemoveForAllUsers : RemovalOptions.None; 124 | 125 | var deploymentOperation = packageManager.RemovePackageAsync(fullPackageName, removalOptions); 126 | 127 | try { 128 | await deploymentOperation; 129 | } catch (Exception ex) { 130 | Console.Error.WriteLine($"error: {fullPackageName} - {ex.Message}"); 131 | return 1; 132 | } 133 | 134 | if (deploymentOperation.Status == AsyncStatus.Error) { 135 | var deploymentResult = deploymentOperation.GetResults(); 136 | Console.Error.WriteLine($"error: {fullPackageName} - {deploymentResult.ErrorText}"); 137 | 138 | return 1; 139 | } 140 | 141 | if (deploymentOperation.Status == AsyncStatus.Canceled) { 142 | Console.Error.WriteLine($"error: {fullPackageName} - removal canceled"); 143 | return 1; 144 | } 145 | 146 | if (deploymentOperation.Status == AsyncStatus.Completed) { 147 | return 0; 148 | } 149 | 150 | return 1; 151 | } 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /AppxPackagesManager/AppxPackagesManager/ViewModels/MainViewViewModel.cs: -------------------------------------------------------------------------------- 1 | using AppxPackagesManager.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Collections.ObjectModel; 5 | using System.Linq; 6 | using System.Reflection; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | 10 | 11 | namespace AppxPackagesManager.ViewModels { 12 | internal class MainViewViewModel : ViewModelBase { 13 | private ObservableCollection InternalPackagesGridItems { get; set; } 14 | 15 | public RelayCommand RefreshCommand => new RelayCommand(execute => Task.Run(PopulateInternalPackages)); 16 | public RelayCommand UninstallSelectedCommand => new RelayCommand(execute => UninstallSelectedPackages(), canExecute => PackagesGridItems.Count(package => package.IsUninstall) > 0); 17 | public RelayCommand SelectAllCommand => new RelayCommand(execute => { SelectAllPackages(true); }, canExecute => PackagesGridItems.Count(package => package.IsUninstall) != PackagesGridItems.Count(package => package.CanUninstall)); 18 | public RelayCommand SelectionClearCommand => new RelayCommand(execute => { SelectAllPackages(false); }, canExecute => PackagesGridItems.Count(package => package.IsUninstall) > 0); 19 | 20 | public string Title { get; set; } 21 | 22 | private string packagesCount; 23 | public string PackagesCount { 24 | get => packagesCount; 25 | set { 26 | packagesCount = value; 27 | OnPropertyChanged(); 28 | } 29 | } 30 | 31 | private ObservableCollection packagesGridItems; 32 | public ObservableCollection PackagesGridItems { 33 | get => packagesGridItems; 34 | set { 35 | packagesGridItems = value; 36 | OnPropertyChanged(); 37 | } 38 | } 39 | 40 | private string searchQuery; 41 | public string SearchQuery { 42 | get => searchQuery; 43 | set { 44 | searchQuery = value; 45 | RefreshGridView(); 46 | } 47 | } 48 | 49 | public ObservableCollection PackageTypes { get; set; } 50 | 51 | private string selectedPackagesType; 52 | public string SelectedPackagesType { 53 | get => selectedPackagesType; 54 | set { 55 | selectedPackagesType = value; 56 | RefreshGridView(); 57 | } 58 | } 59 | 60 | private bool isAllUsersPackages = false; 61 | public bool IsAllUsersPackages { 62 | get => isAllUsersPackages; 63 | set { 64 | isAllUsersPackages = value; 65 | _ = Task.Run(PopulateInternalPackages); 66 | } 67 | } 68 | 69 | 70 | private bool isWindowEnabled = true; 71 | public bool IsWindowEnabled { 72 | get => isWindowEnabled; 73 | set { 74 | isWindowEnabled = value; 75 | OnPropertyChanged(); 76 | } 77 | } 78 | 79 | public MainViewViewModel() { 80 | // set window title 81 | var version = Assembly.GetExecutingAssembly().GetName().Version; 82 | Title = $"AppxPackagesManager v{version.Major}.{version.Minor}.{version.Build}"; 83 | 84 | InitSelectedPackages(); 85 | 86 | PopulateInternalPackages(); 87 | } 88 | 89 | private void InitSelectedPackages() { 90 | PackageTypes = new ObservableCollection { 91 | PackageType.AllPackages, 92 | PackageType.Packages, 93 | PackageType.NonRemovablePackages, 94 | PackageType.FrameworkPackages 95 | }; 96 | 97 | SelectedPackagesType = PackageTypes.FirstOrDefault(packageType => packageType == PackageType.Packages); 98 | } 99 | 100 | private void RefreshGridView() { 101 | IsWindowEnabled = false; 102 | 103 | // gets called in SearchQuery setter but InternalPackagesGridItems is null initially 104 | if (InternalPackagesGridItems == null) { 105 | return; 106 | } 107 | 108 | PackagesGridItems = new ObservableCollection(InternalPackagesGridItems); 109 | 110 | // handle search query 111 | if (SearchQuery != null && searchQuery != "") { 112 | var searchQuery = SearchQuery.ToLower(); 113 | 114 | PackagesGridItems = new ObservableCollection( 115 | PackagesGridItems.Where( 116 | package => package.PackageName.ToLower().Contains(searchQuery) 117 | || package.FriendlyName.ToLower().Contains(searchQuery) 118 | ) 119 | ); 120 | } 121 | 122 | if (SelectedPackagesType == PackageType.Packages) { 123 | PackagesGridItems = new ObservableCollection( 124 | PackagesGridItems.Where(package => !bool.Parse(package.IsNonRemovable) && !bool.Parse(package.IsFramework)) 125 | ); 126 | } else if (SelectedPackagesType == PackageType.NonRemovablePackages) { 127 | PackagesGridItems = new ObservableCollection( 128 | PackagesGridItems.Where(package => bool.Parse(package.IsNonRemovable)) 129 | ); 130 | } else if (SelectedPackagesType == PackageType.FrameworkPackages) { 131 | PackagesGridItems = new ObservableCollection( 132 | PackagesGridItems.Where(package => bool.Parse(package.IsFramework)) 133 | ); 134 | } 135 | 136 | PackagesCount = $"Packages: {PackagesGridItems.Count}/{InternalPackagesGridItems.Count}"; 137 | IsWindowEnabled = true; 138 | } 139 | 140 | private void PopulateInternalPackages() { 141 | IsWindowEnabled = false; 142 | 143 | // clear items for refresh 144 | InternalPackagesGridItems = new ObservableCollection(); 145 | 146 | var packages = Utils.GetPackagesDatabase(IsAllUsersPackages); 147 | 148 | foreach (var package in packages) { 149 | var hasDependencies = package.Value.RequiredByPackages.Count != 0; 150 | 151 | InternalPackagesGridItems.Add(new PackagesGridItemModel { 152 | CanUninstall = !hasDependencies && !package.Value.IsNonRemovable, 153 | CheckBoxToolTip = hasDependencies || package.Value.IsNonRemovable ? "This package can't be uninstalled because it is required by other packages or because it is marked as non-removable" : "", 154 | IsUninstall = false, 155 | FriendlyName = package.Value.FriendlyName, 156 | PackageName = package.Key, 157 | RequiredByPackages = string.Join("\n", package.Value.RequiredByPackages), 158 | Version = package.Value.Version, 159 | IsNonRemovable = package.Value.IsNonRemovable.ToString(), 160 | IsFramework = package.Value.IsFramework.ToString(), 161 | InstallLocation = package.Value.InstallLocation, 162 | }); 163 | } 164 | 165 | RefreshGridView(); 166 | IsWindowEnabled = true; 167 | } 168 | 169 | private void SelectAllPackages(bool isSelectAll) { 170 | foreach (var package in PackagesGridItems) { 171 | package.IsUninstall = isSelectAll && package.CanUninstall; 172 | } 173 | } 174 | 175 | private async void UninstallSelectedPackages() { 176 | if (MessageBox.Show($"Are you sure you want to remove {PackagesGridItems.Count(package => package.IsUninstall)} package(s)?", "AppxPackagesManager", MessageBoxButton.YesNo) != MessageBoxResult.Yes) { 177 | return; 178 | } 179 | 180 | IsWindowEnabled = false; 181 | 182 | var removalSucceeds = 0; 183 | var failedPackages = new List(); 184 | 185 | foreach (var package in PackagesGridItems) { 186 | // only the uninstallable packages should be checked but we can check if it can be uninstalled again 187 | if (package.IsUninstall && package.CanUninstall) { 188 | if (await Utils.UninstallPackage(package.PackageName, IsAllUsersPackages) != 0) { 189 | failedPackages.Add(package.PackageName); 190 | } else { 191 | removalSucceeds++; 192 | } 193 | } 194 | } 195 | 196 | var msg = $"Removed {removalSucceeds} package(s)"; 197 | 198 | if (failedPackages.Count != 0) { 199 | msg += $", failed to remove {failedPackages.Count} package(s):\n\n{string.Join("\n", failedPackages)}"; 200 | } 201 | 202 | _ = MessageBox.Show(msg, "AppxPackagesManager", MessageBoxButton.OK, MessageBoxImage.Information); 203 | 204 | PopulateInternalPackages(); 205 | IsWindowEnabled = true; 206 | } 207 | } 208 | } 209 | -------------------------------------------------------------------------------- /AppxPackagesManager/AppxPackagesManager/ViewModels/RelayCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Input; 3 | 4 | namespace AppxPackagesManager.ViewModels { 5 | internal class RelayCommand : ICommand { 6 | private readonly Action execute; 7 | private readonly Func canExecute; 8 | 9 | public event EventHandler CanExecuteChanged { 10 | add => CommandManager.RequerySuggested += value; 11 | remove => CommandManager.RequerySuggested -= value; 12 | } 13 | 14 | public RelayCommand(Action execute, Func canExecute = null) { 15 | this.execute = execute; 16 | this.canExecute = canExecute; 17 | } 18 | 19 | public bool CanExecute(object parameter) { 20 | return canExecute == null || canExecute(parameter); 21 | } 22 | 23 | public void Execute(object parameter) { 24 | execute(parameter); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /AppxPackagesManager/AppxPackagesManager/ViewModels/ViewModelBase.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Runtime.CompilerServices; 3 | 4 | namespace AppxPackagesManager.ViewModels { 5 | internal class ViewModelBase : INotifyPropertyChanged { 6 | public event PropertyChangedEventHandler PropertyChanged; 7 | protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) { 8 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /AppxPackagesManager/AppxPackagesManager/Views/MainView.xaml: -------------------------------------------------------------------------------- 1 |  14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 34 | 39 | 44 |