Skip to content

Commit fc1a20c

Browse files
mcleanbyronchigygabbybilkakat-ySavoySchuler
authored
Doc updates for Windows App SDK 1.0 Experimental 1 (#1748)
* Updated file names * Removed search pattern from the list * Initial PipsPager guidance page * Create PipsPager guidance docs and add images * Expander guidance doc and images * BreadcrumbBar guidance doc and images * Updated docs related to menu and context menu to improve clarity and better define design perspective. * fix typo in metadata, move image above WinUI block * Fix typo, formatting * fix repeated word, formatting * minor edits * Update rounded corner specification to WinUI 2.6 truth (#1340) * Update rounded corner specification to WinUI 2.6 truth * Removed perf comment * Updated to make sense for WinUI 2.6 release * Changed code to update to change made * Updated code sample * Update note section * Update per review feedback * Update menus-and-context-menus.md The page header was weirdly partially duplicated again after "Is this the right control?". I have removed that duplicate content and adjusted the page header sizes to be coherent. * Hyperlinked core occurances of command bar flyout and menu * Update acrylic.md * Update xaml-theme-resources.md * Add Custom Control Styling to XAML Styles page This includes how to best use Lightweight styling resources with custom controls as well as a note around themedictionaries and trying to avoid re-templating controls when possible. * Update timing + easing animation page (#1361) * Initial commit update design contact in header for timing page * Update timing text * Update easing function doc * #31651095, #31650853 (#1385) * #31651095, #31650853 * fix link Co-authored-by: Andrew Glass <[email protected]> * Updated guidance docs to include ImageIcon (#1327) * Updates to Color in Windows apps page (#1384) * Update color.md Quick set of updates. * Update color.md Deleted section about "scoping system colors" because ColorPatelleteResources are no longer compatible with new color system. * Mamatt/animated icon updates (#1460) * Create animated-icon.md * Update animated-icon.md * Update animated-icon.md * Update animated-icon.md * Updates based on feedback. * More updates based on feedback * updated formatting of links * First edit pass complete. Tried to coordinate content with corresonding API topics (#1458) * added to TOC and Icons topic * build warnings * minor clarification * another minor rev Co-authored-by: MarissaMatt <[email protected]> * Kbridge mamatt/animated icon updates missed revs (#1461) * Create animated-icon.md * Update animated-icon.md * Update animated-icon.md * Update animated-icon.md * Updates based on feedback. * More updates based on feedback * updated formatting of links * First edit pass complete. Tried to coordinate content with corresonding API topics (#1458) * added to TOC and Icons topic * build warnings * minor clarification * another minor rev * missed revs Co-authored-by: MarissaMatt <[email protected]> * Starting off preview docs * Adjusting TOC and updating links * Pushing changes to reunion docs, mentioning 0.8 preview * making language more concise * Update horizontal images * Updates * Updating docs with new Preview VSIX story * Some more minor tweaks * Initial edit pass (#1471) * Initial edit pass * PM review * Making changes based on updates to project templates * Added new preview section (#1484) * Context menu updates (round 2) (#1480) * Fixed issue with CommandBar page referencing CommandBarFlyout instead of CommandBarin XCG link * Removed confusing recommendation for using MenuBar in conjunction with CommandBar. * Removed comment about MenuFlyouts "saving space" as this is not the purpose for their use. * Added helpful pointer to collection commanding examples. * Update menus-and-context-menus.md Fix duplicate description Co-authored-by: KB <[email protected]> * Updating list of bug fixes * Adding known issue (unfinished) * Attempts to address feedback from Chigusa (#1487) * attempts to address feedback * review feedback incorporated * Editing with visual studio issue * Adding known issue with color helper * Updating .NET SDKinfo * forgot toc entry * Updating articles based on new preview VSIX * Adding known issue * Changes based on Karl's feedback * Update release-notes-08-preview.md fix build warning * A few last minute tweaks * One more bug fix * Merging latest content updates for 0.8 preview (#1536) * Removed draft preview node (#1537) * Edit pass * Adding some info on new commandbar features * Edit pass * Zaryaf/release reunion 0.8 preview2 (#1539) * Update deploy page Took out architecture info and added in unpackaged app deployment info * New articles 1) architecture article on deployment 2) Install Reunion with links to all the things they would need to install 3) article for checking versions - need to add content (deployment/VSIX) 4) article to remove versions - need to add content (deployment/VSIX) * Update toc.yml Proposal to update toc so all the install and deployment articles are together. * Updated article on remove Added content with image showing how to remove runtime packages * Update "How to check versions" article Included content for checking the runtime version and the console output * Fixing links Added .md at the end of the page links * updated TOC and deployment 1) moved the set up instructions to the install article 2) updated TOC for deployment * fix formatting issue Need to fix indenting that might have caused error. * Fix formatting issues * fix formatting of bullets * POC of reunion release notes * Added release notes to TOC * Moved MRTCore and DWrite core above Deploy in TOC * Updated WinUI release notes * Fixing text hierarchy in release notes * Formatting WinUI namespaces in release notes * Updated VSIX link * Fixed formatting issue with VSIX download button * Removed VSIX placeholders in Chec/remove version articles * Updated titles in runtime architecture doc * Update to deployment architecture content * Testing line break above related topics * Update to deployment section Separated out instructions for testing and IT professionals., and other formatting changes for related content. * Update to workload instructions Restructured instructions so it is by section of the installation dialog instead of by app type. Also remove references to extension in the deployment articles. * Updating VS install instructions * Fixing list formatting of VS instructions * Fixing link for development enviroment * Updates to removal guidance * Updated release notes * Added further details for deployment release notes * Edits to 0.8 Preview content (#1543) Co-authored-by: McLean Schofield <[email protected]> * Users/hickeys/reunion 08p2 (#1545) * Add app lifecycle docs * Update resource packaging note in MRTCore that applies only to reunion 0.5 * Final tweaks to applifecycle articles * Update absolute links to relative * Add app lifecycle docs * Update resource packaging note in MRTCore that applies only to reunion 0.5 * Final tweaks to applifecycle articles * Update absolute links to relative * Change more absolute links to relative * Edits * Fixed links Co-authored-by: McLean Schofield <[email protected]> * More consistency edits for Preview release (#1548) * Fixed warnings (#1549) * Adding new release channels articles (#1550) * WinUI 3 Docs for Reunion May 0.8 Preview (#1542) * Updating TOC for WinUI release notes (#1551) * Moving relnotes around * shortening toc entry * Added notes about preview samples coming soon (#1554) * Added notes about preview samples coming soon * Edit * Adding in unpackaged app tutorial (#1553) * Adding in unpackaged app tutorial * Updating tutorial article * Fix commas * fixing image link * Removing colon after Tutorial and updating date * fixing image url * Moving Deployment tutorial below architecture * Fixing bullet formatting * Content fixes for tutorial * Adding link to DD spec on Github * fix spelling mistake Co-authored-by: McLean Schofield <[email protected]> * Edited new deployment tutorial (#1556) * Changing order of WinUI release notes in TOC (#1557) * Changing toc order * Changing order again * changing order one last time! * Removed empty lines from TOC * Update tutorial-unpackaged-deployment.md (#1561) fix preview version numbers * Update content and images (#1494) * Update content and images * Update image alt-text * Update guidance for breadcrumb bar * Remove extra blank lines * Add BreadcrumbBar to TOC * Shadow article update * Update styles articles * Minor grammer changes * updated wording to remove "read more" pattern * Updated product name references (#1591) * Refactored release channel articles and other improvements (#1592) * Fixed typo * Minor tweak * Updated release channels guidance (#1604) * Fixed links (#1605) * repo sync * Move design section from windows-app-src to hub (#1609) * Update index.md * Update xaml-styles.md * Fix links broken when files were moved (#1610) * Fix links broken when files were moved * Fix two more links * Move files again and update some config files (#1611) * Fixed some build warnings (#1613) * Updating WinUI docs for 0.8 GA (#1612) * Update type ramp * Fixed Project Reunion references (#1616) * Update content and images (#1502) * Update content and images * make links relative * Add to TOC, update metadata description * Make column lengths even * Removed article (#1618) * updates to typography page (#1619) * #31651095 - initial draft * fix link * Cleanup whitespace * Update type ramp image * Ellipsis as default * Swap png for svg * Update images * Delete type ramp png * minor edits, link fix Co-authored-by: Andrew Glass <[email protected]> * DWriteCore release notes (#1620) * edit pass * update 64px to 128px * Customer support & samples (#1623) * Edit pass * align menu flyout in sample code to match image * IA improvements and other updates (#1625) * Updated deployment article (#1626) * move new pages from windows-apps-src to hub * Make absolute links relative * Incorporated team feedback (#1629) * A few more updates for 0.8 docs (#1631) * Update note regarding resource configuration * change list to unordered * fix language slugs * fix underscore in image names * fix underscore in image name * convert HTML tables to markdown * Updated some OS references (#1634) * update titleSuffix metadata to "Windows apps" * move style-related pages to style folder * rename app-bars.md to command-bar.md * rename controls-and-patterns to controls * update links * fix links and images from move * update redirect.json * fix validation warnings * Update depth-shadow.md * Updated articles (#1638) * update depth-shadow.md * TOC and Support (#1640) * TOC and Support 1) Removed 'experimental' from deployment node in TOC. It is already marked in the note. 2) Updated links for Support based on feedback from John. * Removing unnecessary nesting * Proposed restructuring to highlight important release info * delete .db files * add redirect for menus-and-context-menus * Adding specification to known issue (#1641) * Adding specification to known issue * Changing C# to .NET * Doc updates for Reunion 0.8 GA (#1633) * Improved deployment content and some link targets (#1644) * Making updates based on dev review * Fixing CommandBarFlyout * redirecting to generated IWindowNative docs in winapps-win32-api (#1647) * redirecting to generated IWindowNative docs in winapps-win32-api * doc id to false * Last-minute development environment updates (#1648) * Users/hickeys/release cobalt/hickeys updates (#1650) * Add new design docs and images * Add new store docs and images * Fix build warnings * New and updated articles for Design docs (#1649) * Add hello world tutorial * rename file * add 'make apps great' doc * Update InfoBar with right aligned button example * add mention of Expander * Image updates from XCG * add Mica guidance * add missing link * update breadcrumbbar image * minor edit * Update image * rename images to meet guidelines * fix names and links * Winui2.6 releasenotes release cobalt (#1646) * setting up * First draft RN * first draft * added PipsPager and placeholders for other features * minor grammar rev * wrong image * added visual style content * added ImageIcon info * added SplitButton style section * removed popup and added XCG link * remove windows ref * updated content from Ana and revised image refs * updated dates * links * chigusa review * Add Mica information Co-authored-by: Jim Walker (WINDOWS) <[email protected]> * Added some links (#1653) * Revised build availability note (#1654) * Add release note for MRTCore (#1651) * Fixed merge conflicts * Updates for Windows App SDK 1.0 exp release (#1738) * Updated support and servicing (#1739) * Windowing conceptual doc for 1.0 Experimental 1 release (#1745) * Update windowing-overview.md Added more details and provided updated sample code for WinUI interop using C++ and C#. * Update windowing-overview.md Added details about presenters since this is a core concept and something that may not be immediately intuitive. * Update windowing-overview.md Removed the preview reference since that page did not actually exist. :) * Update windowing-overview.md * Update windowing-overview.md Updated the C++ code snippet to reflect latest API changes. * Update windowing-overview.md Incorporated feedback from first team review. * Update windowing-overview.md Updated version naming. Changed sample link to be to the top-level sample directory for now, will add proper link to sample once published. * Update windowing-overview.md Fixed the absolute link for UWP AppWindow to be relative. * minor edits and formatting fixes for windowing doc * Winapp sdk push 1.0 exp1 (#1746) * initial commit * added to toc * removed unpackegd docs * removed toast in overview * added access token rquest and push notification * added COM manifest registration * updated docs per wnp engineer feedback. Added troubleshooting * converted usage to quick start * added nits * renamed troubleshooting * removed required statement * added 8/4 feedback * Users/hickeys/winapp sdk push 1.0 exp1/push notifications (#1742) * First draft of push notification revisions * Fix merge conflicts * Update author metadata * added disclaimers * Edits Co-authored-by: Shawn Hickey <[email protected]> Co-authored-by: McLean Schofield <[email protected]> * Fixing VSIXname (#1747) * Added dynamic dependencies guidance (#1732) * Update with 1.0 Experimental release notes (#1740) * Added back push notifications limitations to exp channel article (#1749) * Edited docs (#1751) * Updating VS version (#1750) * Fixing VSIXname * note about vs support * Clearing up VS confusion * updated links to installer exp-1.0 (#1752) * Small revisions for push notifications articles (#1753) * adding general and Windowing issues (#1755) * Updating package version number (#1759) * Update experimental-channel.md (#1761) * Fixing link in 1.0 exp release notes (#1763) * Fixing link * A few last min changes Co-authored-by: Chigusa Sansen <[email protected]> Co-authored-by: Gabby Bilka <[email protected]> Co-authored-by: Kat <[email protected]> Co-authored-by: My Name <[email protected]> Co-authored-by: Jim Walker <[email protected]> Co-authored-by: Courtney Wales <[email protected]> Co-authored-by: Yulia Klein <[email protected]> Co-authored-by: kikisaints <[email protected]> Co-authored-by: Steven Moyes <[email protected]> Co-authored-by: Andrew Glass <[email protected]> Co-authored-by: Andrew Glass <[email protected]> Co-authored-by: MarissaMatt <[email protected]> Co-authored-by: KB <[email protected]> Co-authored-by: anawishnoff <[email protected]> Co-authored-by: Andrea Courtright <[email protected]> Co-authored-by: Dennis Rea <[email protected]> Co-authored-by: zaryaf <[email protected]> Co-authored-by: Shawn Hickey <[email protected]> Co-authored-by: Mick Alberts <[email protected]> Co-authored-by: AdamBrMSFT <[email protected]> Co-authored-by: QuinnRadich <[email protected]> Co-authored-by: PRMerger20 <[email protected]> Co-authored-by: Steven White <[email protected]> Co-authored-by: Diana Hanson <[email protected]> Co-authored-by: Shannon Leavitt <[email protected]> Co-authored-by: Shawn Hickey <[email protected]> Co-authored-by: PRMerger16 <[email protected]> Co-authored-by: Shana McKibbin <[email protected]> Co-authored-by: PRMerger9 <[email protected]> Co-authored-by: Roberth Karman <[email protected]> Co-authored-by: Nicu Parente <[email protected]>
1 parent 319ff42 commit fc1a20c

26 files changed

+1052
-126
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
description: Learn about the package graph and servicing model for MSIX framework packages.
3+
title: MSIX framework packages and dynamic dependencies
4+
ms.topic: article
5+
ms.date: 07/30/2021
6+
ms.localizationpriority: medium
7+
---
8+
9+
# MSIX framework packages and dynamic dependencies
10+
11+
This article introduces important concepts related to *MSIX framework packages*. The information in this article provides useful context to help you better understand the design and purpose of the *dynamic dependencies* feature in the Windows App SDK and in the Windows 11 OS. This feature enables your apps to reference and use MSIX framework packages at run time.
12+
13+
## Framework packages and the package graph
14+
15+
[MSIX](/windows/msix) is a package format that provides a modern packaging and deployment experience. It also provides a clean and trusted way to package redistributable libraries, content and components via *MSIX framework packages*. An MSIX framework package allows MSIX-packaged apps to access components through a single shared source on the user's device, instead of bundling them into the app package. Common framework packages include the [Windows App SDK](../../../windows-app-sdk/index.md) (including WinUI3), [WinUI2](../../../winui/winui2/index.md), [VCLibs](/troubleshoot/cpp/c-runtime-packages-desktop-bridge), and the DirectX Runtime.
16+
17+
Starting in Windows 8 and continuing through Windows 10 and Windows 11, every process has a *package graph* that provides the list of all the packages available to the app, including framework, resource, optional, and main packages. This graph allows the app to load DLLs, content, and run-time class declarations provided by a referenced package. Historically, this graph was fixed at process creation time, and there was no way to alter it at run time:
18+
19+
- For MSIX-packaged apps, the graph was initialized based on the package dependencies declared in the [PackageDependency](/uwp/schemas/appxpackage/uapmanifestschema/element-packagedependency) element in the app's package manifest. When building a packaged app, this was typically done for you during the build process based on your project references and dependencies.
20+
- For unpackaged apps (that is, apps that do not use MSIX for their deployment technology), the package graph was empty and could not be changed. Therefore, unpackaged apps were limited to [standard DLL search order](/windows/win32/dlls/dynamic-link-library-search-order) and could not access framework packages.
21+
22+
This static package graph restriction is lifted with the introduction of the dynamic dependencies support in both the [Windows App SDK](../../../windows-app-sdk/index.md) and in Windows 11. Developers can use dynamic dependencies to reference and use MSIX framework packages from their apps at run time. Dynamic dependencies removes the static package graph restriction from apps, and developers can decide how they want to leverage framework packages.
23+
24+
## Primary scenarios for dynamic dependencies
25+
26+
Although dynamic dependencies enables any app to add a package framework dependency at run time, this feature is primarily intended to be used by unpackaged apps. Packaged apps can still continue to add static dependencies via the [PackageDependency](/uwp/schemas/appxpackage/uapmanifestschema/element-packagedependency) element in their package manifest.
27+
28+
- Most developers will only use dynamic dependencies to reference the [Windows App SDK](../../../windows-app-sdk/index.md) framework package in an unpackaged app so that the app can call APIs provided by the Windows App SDK runtime. For more information about this scenario, see [Reference the Windows App SDK framework package at run time](../../../windows-app-sdk/reference-framework-package-run-time.md).
29+
- In some cases, developers may want to use dynamic dependencies to reference a different framework package (other than the Windows App SDK framework package) from an unpackaged app, such as the framework package for [WinUI2](../../../winui/winui2/index.md) or the DirectX Runtime. For more information about this scenario, see [Reference framework packages at run time](use-the-dynamic-dependency-api.md).
30+
31+
## Servicing model for framework packages
32+
33+
The dynamic dependencies feature preserves the integrity of the servicing pipeline for the framework package that is being referenced and used dynamically at run time.
34+
35+
MSIX framework packages support servicing in a side-by-side model, meaning each version is installed in its own separate versioned folder. This allows applications in use to be able to stay up and running even when a newer app installs a newer version of the framework package. The OS has uninstall logic for when to delete older versions of a given framework package, based on the presence of *install-time references* and *run-time references* for the package.
36+
37+
- When an app is installed, it can create an *install-time reference* to a framework package. This reference informs the OS that the app has a dependency upon the specified framework package so that the OS won't uninstall the framework package while your app is installed.
38+
- When an app needs to use APIs or content in a framework package, it can add a *run-time reference* to the framework package. This reference informs the OS that the framework package is in active use and to handle any version updates in a side-by-side manner. If a new version of the framework package is installed, but a running app has an older version in use, the OS cannot remove the older version until all run-time references to the older version are removed.
39+
40+
For example, given this scenario:
41+
42+
- **App A** is running and using version 1.0.0.0 of a given framework package.
43+
- **App B** is installed and has a dependency upon version 1.0.0.1 of the same framework package.
44+
45+
In this scenario, both versions of the framework package will be installed and in use by **App A** and **App B**. However, when **App A** is closed by the user and then restarted, it will pick up the newer version 1.0.0.1 of the framework package. At this point, the run-time reference requirement is no longer valid for version 1.0.0.0 of the framework package, and the OS can safely remove the 1.0.0.0 version. Later, when **App A** and **App B** are uninstalled by the user, then the install-time reference requirement is no longer valid and it is safe for the OS to remove the framework package entirely.
46+
47+
For MSIX-packaged apps that use the [PackageDependency](/uwp/schemas/appxpackage/uapmanifestschema/element-packagedependency) element to specify static references to framework packages, the install-time references for framework packages are tracked by the OS when the app is installed or uninstalled. For run-time references that are managed by using the dynamic dependencies feature, the OS knows when a packaged app is running and will avoid removing its in-use framework packages when a newer one is available.
48+
49+
## Related topics
50+
51+
- [Reference the Windows App SDK framework package at run time](../../../windows-app-sdk/reference-framework-package-run-time.md)
52+
- [Use the dynamic dependency API to reference framework packages at run time](use-the-dynamic-dependency-api.md)
53+
- [Deploy unpackaged apps that use the Windows App SDK](../../../windows-app-sdk/deploy-unpackaged-apps.md)
54+
- [Run time architecture and deployment scenarios for the Windows App SDK](../../../windows-app-sdk/deployment-architecture.md)
55+
- [Tutorial: Build and deploy an unpackaged app that uses the Windows App SDK](/windows/apps/windows-app-sdk/tutorial-unpackaged-deployment)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
description: Learn about using MSIX framework packages dynamically from your desktop app.
3+
title: Use MSIX framework packages dynamically from your desktop app
4+
ms.topic: article
5+
ms.date: 07/30/2021
6+
ms.localizationpriority: medium
7+
---
8+
9+
# Use MSIX framework packages dynamically from your desktop app
10+
11+
The [Windows App SDK](../../../windows-app-sdk/index.md) and the Windows 11 OS both enable your apps to reference and use [MSIX framework packages](framework-packages-overview.md) dynamically at run time by using a feature called *dynamic dependencies*. This feature is intended to be used primarily by unpackaged desktop apps (that is, apps that do not use MSIX for their deployment technology) to use APIs and other content provided by MSIX framework packages.
12+
13+
The most common scenario for using the dynamic dependencies feature is to reference the [Windows App SDK](../../../windows-app-sdk/index.md) framework package in an unpackaged app. In some scenarios, you may want to use the dynamic dependencies feature to reference a different framework package from an unpackaged app, such as the framework package for [WinUI2](../../../winui/winui2/index.md) or the DirectX Runtime.
14+
15+
For an overview of the dynamic dependencies feature and guidance about using it in your apps, see the following articles.
16+
17+
| Article | Description |
18+
|---------|-------------|
19+
| [MSIX framework packages and dynamic dependencies](framework-packages-overview.md) | Introduces important concepts related to MSIX framework packages and describes the purpose of dynamic dependencies feature. This article includes details about the package graph for framework package references and the servicing model for framework packages. |
20+
| [Reference the Windows App SDK framework package at run time](../../../windows-app-sdk/reference-framework-package-run-time.md) | Describes how to use the *bootstrapper API* to dynamically take a dependency on the Windows App SDK framework package in an unpackaged app at run time. This scenario enables unpackaged apps to use Windows App SDK features. |
21+
| [Reference framework packages at run time](use-the-dynamic-dependency-api.md) | Describes how to use the *dynamic dependency API* to dynamically take a dependency on different framework packages (other than the Windows App SDK framework package) in an unpackaged app at run time. |
22+
23+
## Related topics
24+
25+
- [Deploy unpackaged apps that use the Windows App SDK](../../../windows-app-sdk/deploy-unpackaged-apps.md)
26+
- [Runtime architecture and deployment scenarios for the Windows App SDK](../../../windows-app-sdk/deployment-architecture.md)
27+
- [MSIX documentation](/windows/msix)
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
description: Learn about how to use the dynamic dependency API.
3+
title: Use the dynamic dependency API to reference framework packages at run time
4+
ms.topic: article
5+
ms.date: 07/30/2021
6+
ms.localizationpriority: medium
7+
---
8+
9+
# Use the dynamic dependency API to reference framework packages at run time
10+
11+
The *dynamic dependency API* enables unpackaged apps (that is, apps that do not use MSIX for their deployment technology) to reference and use framework packages other than the Windows App SDK framework package. For example, you might use the dynamic dependency API to reference and use the framework package for [WinUI2](../../../winui/winui2/index.md) or the DirectX Runtime in your unpackaged app.
12+
13+
For background information about this scenario, see [MSIX framework packages and dynamic dependencies](framework-packages-overview.md).
14+
15+
> [!NOTE]
16+
> If you only want to reference the [Windows App SDK](../../../windows-app-sdk/index.md) framework package in your unpackaged app, use the *bootstrapper API* provided by the Windows App SDK instead of the dynamic dependency API. The bootstrapper API is a specialized form of the dynamic dependency API that is designed to take dependencies on the Windows App SDK framework package. After your unpackaged app uses the bootstrapper API to take a dependency on the Windows App SDK framework package, your app can then use APIs provided by the Windows App SDK (including using the dynamic dependency API implementation in the Windows App SDK to take dependencies on other framework packages). For more information about the bootstrapper API, see [Reference the Windows App SDK framework package at run time](../../../windows-app-sdk/reference-framework-package-run-time.md).
17+
18+
## Overview
19+
20+
The dynamic dependency API provides ways to manage the install-time references and run-time references for a framework package. For more information about these types of references, see [Servicing model for framework packages](framework-packages-overview.md#servicing-model-for-framework-packages).
21+
22+
There are two implementations of the dynamic dependency API that you can choose from, depending on your target platform and scenario:
23+
24+
- The Windows App SDK provides both C/C++ functions and WinRT types that implement the dynamic dependency API. This implementation of the API can be used by apps that target Windows 10 version 1809 and later as well as Windows 11, but it has [some limitations](#dynamic-dependency-api-limitations-in-the-windows-app-sdk).
25+
- Windows 11 also provides C/C++ functions that implement the dynamic dependency API. This implementation of the API can be used only by apps that target Windows 11.
26+
27+
For more details about the dynamic dependency API, see the [dynamic dependencies specification](https://github.com/microsoft/WindowsAppSDK/blob/main/specs/dynamicdependencies/DynamicDependencies.md) on GitHub.
28+
29+
## How to use the dynamic dependency API
30+
31+
To use the dynamic dependency API in your unpackaged app to take a dependency on a framework package, follow this general pattern in your code.
32+
33+
### 1. Create an install-time reference
34+
35+
In your app's installer or during the first run of your app, call one of the following functions or methods to specify a set of criteria for the framework package you want to use. This informs the OS that your app has a dependency upon a framework package that meets the specified criteria. If one or more framework packages are installed that meet the criteria, Windows will ensure that at least one of these framework packages will remain installed until the install-time reference is deleted.
36+
37+
- Windows 11 (C/C++): **TryCreatePackageDependency**
38+
- Windows App SDK (C/C++): **MddTryCreatePackageDependency**
39+
- Windows App SDK (WinRT): **Microsoft.Windows.ApplicationModel.DynamicDependency.Create**
40+
41+
The criteria you specify includes the package family name, minimum version, and architectures, but you cannot indicate a specific framework package. When you add a run-time reference to the framework package, the API chooses the highest version that satisfies the specified criteria.
42+
43+
You must also specify a *lifetime artifact*, which can be the current process, a file, or a registry key that indicates to the system that the app is still available. If the specified artifact no longer exists, the OS can assume the dependency is no longer needed and it can uninstall the framework package if no other apps have declared a dependency on it. This feature is useful for scenarios where an app neglects to remove the install-time pin when it is uninstalled.
44+
45+
This API returns a dependency ID that must to be used in other calls to create run-time references and to delete the install-time reference.
46+
47+
### 2. Add a run-time reference
48+
49+
When your app needs to use the framework package, call one of the following functions or methods to request access to the specified framework package and add a run-time reference for it. Calling this API informs the OS that the framework package is in active use and to handle any version updates in a side-by-side manner (effectively delay uninstalling or otherwise servicing the older version until after the app is done using it). If successful, the app may activate classes and use content from the framework package.
50+
51+
- Windows 11 (C/C++): **AddPackageDependency**
52+
- Windows App SDK (C/C++): **MddAddPackageDependency**
53+
- Windows App SDK (WinRT): **Microsoft.Windows.ApplicationModel.DynamicDependency.Add**
54+
55+
When you call this API, you must pass in the dependency ID that was returned when you created the install-time reference and the desired rank to use for the framework package in the process's package graph. This API returns the full name of the framework package that was referenced, and a handle that is used to keep track of the active-use dependency. If there are multiple framework packages installed that meet the criteria that you specified when you created the install-time reference, the API chooses highest version that satisfies the criteria.
56+
57+
### 3. Remove the run-time reference
58+
59+
When your app is done using the framework package, call one of the following functions or methods to remove the run-time reference. Typically, your app will call this API during shut down. This API informs the OS that it is safe to remove any unnecessary versions of the framework package.
60+
61+
- Windows 11 (C/C++): **RemovePackageDependency**
62+
- Windows App SDK (C/C++): **MddRemovePackageDependency**
63+
- Windows App SDK (WinRT): **Microsoft.Windows.ApplicationModel.DynamicDependency.Remove**
64+
65+
When you call this API, you must pass in the handle that was returned when you added the run-time reference.
66+
67+
### 4. Delete the install-time reference
68+
69+
When your app is uninstalled, call one of the following functions or methods during unto delete the install-time reference. This API informs the OS that it is safe to remove the framework package if no other apps have a dependency on it.
70+
71+
- Windows 11 (C/C++): **DeletePackageDependency**
72+
- Windows App SDK (C/C++): **MddDeletePackageDependency**
73+
- Windows App SDK (WinRT): **Microsoft.Windows.ApplicationModel.DynamicDependency.Delete**
74+
75+
When you call this API, you must pass in the dependency ID that was returned when you created the install-time reference.
76+
77+
## Dynamic dependency API limitations in the Windows App SDK
78+
79+
When you use the dynamic dependency API in the Windows App SDK to take a dependency on a framework package, this API requires help via another installed package and running process to inform Windows that the framework package is in use and to block servicing the framework while it is being used. This is called a *lifetime manager* component.
80+
81+
The Windows App SDK provides a lifetime manager component for its framework package called the [Dynamic Dependency Lifetime Manager (DDLM)](../../../windows-app-sdk/deployment-architecture.md#dynamic-dependency-lifetime-manager-ddlm). However, no other framework packages currently provide a similar lifetime manager component from Microsoft.
82+
83+
The dynamic dependency API implementation in Windows 11 does not have this limitation.
84+
85+
## Related topics
86+
87+
- [MSIX framework packages](framework-packages-overview.md)
88+
- [Dynamic dependencies specification](https://github.com/microsoft/WindowsAppSDK/blob/main/specs/dynamicdependencies/DynamicDependencies.md)
89+
- [Runtime architecture and deployment scenarios for the Windows App SDK](../../../windows-app-sdk/deployment-architecture.md)
90+
- [Reference the Windows App SDK framework package at run time](../../../windows-app-sdk/reference-framework-package-run-time.md)

0 commit comments

Comments
 (0)