Skip to content

Commit ac61f62

Browse files
author
Santosh Chintalapati
committed
Incorporate PR feedback-1
1 parent 8598fb2 commit ac61f62

File tree

1 file changed

+73
-67
lines changed

1 file changed

+73
-67
lines changed

specs/Deployment/DeploymentAPI.md

+73-67
Original file line numberDiff line numberDiff line change
@@ -3,67 +3,62 @@
33
This is the spec for proposal
44
[Windows App Runtime Deployment API #1240](https://github.com/microsoft/WindowsAppSDK/issues/1240).
55

6-
The Windows App SDK (WinAppSDK) for packaged apps involves the framework, main, and singleton
7-
packages, which are all signed and published by Microsoft. The framework package contains the
8-
WinAppSDK binaries used at run time, and it is installed with the application. The main package
9-
contains out-of-process services that are brokered between apps, such as Dynamic Dependency data
10-
store, and it is also needed for the framework to be serviced by the Microsoft Store. The singleton
11-
package supports a single long-running process that is brokered between apps for features like push
12-
notifications.
13-
14-
Currently, packaged apps can only declare dependencies on WinAppSDK framework package. In order to
15-
get the other WinAppSDK packages (main, singleton) deployed, the packaged apps can use the mechanism
6+
The Windows App SDK (WinAppSDK) for packaged apps involves the Framework, Main, and Singleton
7+
packages, which are all signed and published by Microsoft.
8+
9+
Currently, packaged apps can only declare dependencies on WinAppSDK Framework package. In order to
10+
get the other WinAppSDK packages (Main, Singleton) deployed, the packaged apps can use the mechanism
1611
described here as part of their first-run experience.
1712

1813
> **Note that in Windows App SDK version 1.0**, only unpackaged apps that are full trust or MSIX
1914
> packaged apps that have the packageManagement restricted capability have the permission to use the
20-
> Deployment API to install the main and singleton package dependencies. Support for partial trust
21-
> MSIX packaged apps will be coming in later releases. Additionally, support for main and singleton
15+
> Deployment API to install the Main and Singleton package dependencies. Support for partial trust
16+
> MSIX packaged apps will be coming in later releases. Additionally, support for Main and Singleton
2217
> package deployment through the Microsoft Store will be coming in later releases.
2318
2419
# Description
2520

2621
When a packaged app using the WinAppSDK is deployed from the Store, it will be installed with the
27-
application's main package and the WinAppSDK framework package. The WinAppSDK main and singleton
22+
application's Main package and the WinAppSDK Framework package. The WinAppSDK Main and Singleton
2823
packages may not already be present on the system, or may not be at the version required by the
29-
application. The Deployment API enables a developer to check when the required WinAppSDK main and
30-
singleton packages are missing and get them installed.
24+
application. The Deployment API enables a developer to check when the required WinAppSDK Main and
25+
Singleton packages are missing and get them installed.
3126

32-
Since the Deployment API is part of the WinAppSDK framework package, the framework itself must be
33-
present to use the API. To deploy the WinAppSDK framework package with the MSIX packaged
34-
application, the framework must be declared as a dependency in the application manifest with a min
35-
version specified. For instructions on deploying the framework package, see the
36-
[developer docs](https://docs.microsoft.com/windows/apps/windows-app-sdk/deploy-packaged-apps#deploy-the-windows-app-sdk-framework-package).
27+
Since the Deployment API is part of the WinAppSDK Framework package, the Framework itself must be
28+
present to use the API. To deploy the WinAppSDK Framework package with the MSIX packaged
29+
application, the Framework must be declared as a dependency in the application manifest with a min
30+
version specified. For instructions on deploying the Framework package, see the
31+
[developer docs](https://docs.microsoft.com/windows/apps/windows-app-sdk/deploy-packaged-apps#deploy-the-windows-app-sdk-Framework-package).
3732

38-
If a developer prefers to have the Microsoft Store automatically service the WinAppSDK framework
39-
package and if features like push notifications are desired, then the WinAppSDK main and singleton
40-
should also be deployed. Developers must not assume that the WinAppSDK main and singleton packages
41-
are already present on the system, or that the version present is the minimum version required by
42-
the application. Instead, the Deployment API should be used to validate that the WinAppSDK is at the
43-
correct version and that all required packages are present.
33+
If a developer prefers to have the Microsoft Store automatically service the WinAppSDK Framework
34+
package and if features like dynamic dependencies, push notifications are desired, then the
35+
WinAppSDK Main and Singleton should also be deployed. Developers must not assume that the WinAppSDK
36+
Main and Singleton packages are already present on the system, or that the version present is the
37+
minimum version required by the application. Instead, the Deployment API should be used to validate
38+
that the WinAppSDK is at the correct version and that all required packages are present.
4439

45-
The Deployment API addresses the following three developer scenarios:
40+
The Deployment API addresses the following developer scenarios:
4641

47-
1. Does this system have the min version of the WinAppSDK main and singleton packages required by my
42+
1. Does this system have the min version of the WinAppSDK Main and Singleton packages required by my
4843
app?
49-
2. How do I install the WinAppSDK main and singleton packages, if they are not already present on
44+
2. How do I install the WinAppSDK Main and Singleton packages, if they are not already present on
5045
the system?
51-
3. How do I repair the already installed WinAppSDK main and singleton pacakges, if needed ?
46+
3. How do I repair the already installed WinAppSDK Main and Singleton packages, if needed ?
5247

5348
The API addresses #1 by a simple query of the version needed and a check for OS updates.
5449

55-
#2 has two possible answers.
50+
#2 has the following two possible answers.
5651

57-
- First, the developer can install these packages directly through the app, if possible. These
58-
MSIX packages can be acquired through
52+
- The developer can install these packages directly through the app, if possible. These MSIX
53+
packages can be acquired through
5954
[Downloads page](https://docs.microsoft.com/windows/apps/windows-app-sdk/downloads).
6055
- Alternatively, unpackaged apps that are full trust or MSIX packaged apps that have the
6156
packageManagement restricted capability can use the Deployment API to get these packages
6257
installed.
6358

64-
#3 has two possible answers.
59+
#3 has the following two possible answers.
6560

66-
- First, the developer can repair these packages directly through the app by reinstalling them, if
61+
- The developer can repair these packages directly through the app by reinstalling them, if
6762
possible. These MSIX packages can be acquired through
6863
[Downloads page](https://docs.microsoft.com/windows/apps/windows-app-sdk/downloads).
6964
- Alternatively, unpackaged apps that are full trust or MSIX packaged apps that have the
@@ -74,12 +69,12 @@ The API addresses #1 by a simple query of the version needed and a check for OS
7469
## GetStatus
7570

7671
This is the means by which an app or program can call to verify that all required WinAppSDK packages
77-
are present to a minimum version needed by the framework loaded with the app. A process should call
72+
are present to a minimum version needed by the Framework loaded with the app. A process should call
7873
GetStatus() after process initialization and before using Windows App Runtime content (e.g. in
79-
main() or WinMain()).
74+
Main() or WinMain()).
8075

8176
Developers call this method without parameters, as all information about the version, channel, and
82-
architecture are derived from the current framework package loaded.
77+
architecture are derived from the current Framework package loaded.
8378

8479
```C#
8580
DeploymentResult result = DeploymentManager.GetStatus();
@@ -98,15 +93,17 @@ architecture are derived from the current framework package loaded.
9893

9994
## Initialize
10095

101-
This API performs a status check, and if the main and/or singleton packages are missing or not at
96+
This API performs a status check, and if the Main and/or Singleton packages are missing or not at
10297
the required version, it will attempt to deploy those packages and get the WindowsAppRuntime into an
10398
OK state. All information about the version, channel, and architecture needed are derived from the
104-
current WinAppSDK framework package.
105-
106-
Since both the main _and_ the singleton packages may need to be installed, it is possible that one
107-
package is installed successfully but not the other. If so, the returned WindowsAppRuntimeStatus
108-
will contain the error, if one occurs during package install. There will be no rollback of any
109-
successfully installed packages. See the
99+
current WinAppSDK Framework package.
100+
101+
Since both the Main _and_ the Singleton packages may need to be installed, it is possible that Main
102+
package install has failed and Initialize returns with PackageInstallFailed state (OR) it is
103+
possible that Main package is installed successfully but the Singleton package Install has failed
104+
and Initialize returns with PackageInstallFailed state. In both cases, the returned
105+
WindowsAppRuntimeStatus will contain the error of first package install failure. There will be no
106+
rollback of any successfully installed packages. See the
110107
[developer docs](https://docs.microsoft.com/windows/apps/windows-app-sdk/deploy-packaged-apps#address-installation-errors)
111108
for instructions on how to handle errors.
112109

@@ -115,9 +112,10 @@ concern to some developers. To address these concerns, developers can instead ca
115112
and verify that the required packages are missing. If so, then call Initialize() on another thread
116113
to handle the time delay more elegantly.
117114

118-
Once the main and singleton packages have been deployed, they generally do not need to be deployed
119-
again. If a user were to remove the main or singleton package, the API can be used to reinstall them
120-
again.
115+
Once the Main and Singleton packages have been deployed, they generally do not need to be deployed
116+
again. If a user were to remove the Main or Singleton package, the API can be used to reinstall them
117+
again. If there is anything wrong with installed Main and Singleton packages, use Repair API to try
118+
and repair them.
121119

122120
```C#
123121
if (DeploymentManager.GetStatus().Status != DeploymentStatus.Ok)
@@ -133,7 +131,7 @@ again.
133131
// Check the result.
134132
if (initializeTask.Result.Status != DeploymentStatus.Ok)
135133
{
136-
// The WindowsAppRuntime is in a bad state which Initialize() did not fix.
134+
// The Initialize() has failed.
137135
// Do error reporting or gather information for submitting a bug.
138136
// Gracefully exit the program or carry on without using the WindowsAppRuntime.
139137
}
@@ -152,13 +150,13 @@ by using DeploymentInitializeOptions object and setting ForceDeployment option b
152150
this API. This option when set will shut down the application(s) associated with WinAppSDK packages,
153151
update the WinAppSDK packages and restart the application(s).
154152

155-
If this option is set when updating singleton package, then the out of process com server from the
156-
singleton package such as push Notifications is explicitly restarted.
153+
If this option is set when updating Singleton package, then the out of process com server from the
154+
Singleton package such as push Notifications is explicitly restarted.
157155

158-
When the API is updating framework package and ForceDeployment option is set, then all dependent
156+
When the API is updating Framework package and ForceDeployment option is set, then all dependent
159157
packages that are NOT currently in use will be immediately re-installed to refer to the updated
160-
framework package and all dependent packages that are currently in use will be re-installed, after
161-
they shut down, to refer to the updated framework package.
158+
Framework package and all dependent packages that are currently in use will be re-installed, after
159+
they shut down, to refer to the updated Framework package.
162160

163161
```C#
164162
if (DeploymentManager.GetStatus().Status != DeploymentStatus.Ok)
@@ -179,7 +177,7 @@ they shut down, to refer to the updated framework package.
179177
// Check the result.
180178
if (initializeTask.Result.Status != DeploymentStatus.Ok)
181179
{
182-
// The WindowsAppRuntime is in a bad state which Initialize() did not fix.
180+
// The Initialize() has failed.
183181
// Do error reporting or gather information for submitting a bug.
184182
// Gracefully exit the program or carry on without using the WindowsAppRuntime.
185183
}
@@ -188,19 +186,26 @@ they shut down, to refer to the updated framework package.
188186

189187
## Repair
190188

191-
This API performs a status check, and if the main and singleton packages are already installed at
192-
the required version, it will attempt to repair those packages. All information about the version,
193-
channel, and architecture needed are derived from the current WinAppSDK framework package.
194-
195-
Since both the main _and_ the singleton packages may need to be repaired, it is possible that one
196-
package is repaired successfully but not the other. If so, the returned WindowsAppRuntimeStatus will
197-
contain the error, if one occurs during package install.
189+
This API performs a status check, and if the Main and Singleton packages are both already installed
190+
at the required version (i.e. when GetStatus returns OK status), it will attempt to repair those
191+
packages. All information about the version, channel, and architecture needed are derived from the
192+
current WinAppSDK Framework package.
193+
194+
Since both the Main _and_ the Singleton packages will be repaired, it is possible that Main package
195+
repair has failed and Initialize returns with PackageRepairFailed status (OR) it is possible that
196+
Main package is repaired successfully but the Singleton package repair has failed and Initialize
197+
returns with repair has failed and Initialize returns with PackageRepairFailed status (OR) it is
198+
possible that status. In both cases, the returned WindowsAppRuntimeStatus will contain the error of
199+
first package repair failure. There will be no rollback of any successfully repaired packages. See
200+
the
201+
[developer docs](https://docs.microsoft.com/windows/apps/windows-app-sdk/deploy-packaged-apps#address-installation-errors)
202+
for instructions on how to handle errors.
198203

199204
```C#
200-
if (DeploymentManager.GetStatus().Status != DeploymentStatus.Ok)
205+
if (DeploymentManager.GetStatus().Status == DeploymentStatus.Ok)
201206
{
202207
// Repair does a status check, and if the status is OK it will attempt to get
203-
// the WindowsAppRuntime into a good state by deploying packages. Unlike a simple
208+
// the WindowsAppRuntime into a good state by re-deploying packages. Unlike a simple
204209
// status check, Repair can sometimes take several seconds to deploy the packages.
205210
// These should be run on a separate thread so as not to hang your app while the
206211
// packages deploy.
@@ -210,7 +215,7 @@ contain the error, if one occurs during package install.
210215
// Check the result.
211216
if (repairTask.Result.Status != DeploymentStatus.Ok)
212217
{
213-
// The WindowsAppRuntime is in a bad state which Repair() did not fix.
218+
// The Repair() has failed.
214219
// Do error reporting or gather information for submitting a bug.
215220
// Gracefully exit the program or carry on without using the WindowsAppRuntime.
216221
}
@@ -226,13 +231,14 @@ namespace Microsoft.Windows.ApplicationModel.WindowsAppRuntime
226231
apicontract DeploymentContract{};
227232

228233
/// Represents the current Deployment status of the WindowsAppRuntime
229-
[contract(DeploymentContract, 1)]
234+
[contract(DeploymentContract, 3)]
230235
enum DeploymentStatus
231236
{
232237
Unknown = 0,
233238
Ok,
234239
PackageInstallRequired,
235240
PackageInstallFailed,
241+
PackageRepairFailed,
236242
};
237243

238244
/// Represents the result of a Deployment Manager method.
@@ -256,7 +262,7 @@ namespace Microsoft.Windows.ApplicationModel.WindowsAppRuntime
256262
DeploymentInitializeOptions();
257263

258264
/// Gets or sets a value that indicates whether the processes associated with the
259-
/// WindowsAppSDK main and singleton packages will be shut down forcibly if they are
265+
/// WindowsAppSDK Main and Singleton packages will be shut down forcibly if they are
260266
/// currently in use, when registering the WinAppSDK packages.
261267
Boolean ForceDeployment;
262268
};

0 commit comments

Comments
 (0)