3
3
This is the spec for proposal
4
4
[ Windows App Runtime Deployment API #1240 ] ( https://github.com/microsoft/WindowsAppSDK/issues/1240 ) .
5
5
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
16
11
described here as part of their first-run experience.
17
12
18
13
> ** Note that in Windows App SDK version 1.0** , only unpackaged apps that are full trust or MSIX
19
14
> 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
22
17
> package deployment through the Microsoft Store will be coming in later releases.
23
18
24
19
# Description
25
20
26
21
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
28
23
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.
31
26
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 ) .
37
32
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.
44
39
45
- The Deployment API addresses the following three developer scenarios:
40
+ The Deployment API addresses the following developer scenarios:
46
41
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
48
43
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
50
45
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 ?
52
47
53
48
The API addresses #1 by a simple query of the version needed and a check for OS updates.
54
49
55
- #2 has two possible answers.
50
+ #2 has the following two possible answers.
56
51
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
59
54
[ Downloads page] ( https://docs.microsoft.com/windows/apps/windows-app-sdk/downloads ) .
60
55
- Alternatively, unpackaged apps that are full trust or MSIX packaged apps that have the
61
56
packageManagement restricted capability can use the Deployment API to get these packages
62
57
installed.
63
58
64
- #3 has two possible answers.
59
+ #3 has the following two possible answers.
65
60
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
67
62
possible. These MSIX packages can be acquired through
68
63
[ Downloads page] ( https://docs.microsoft.com/windows/apps/windows-app-sdk/downloads ) .
69
64
- 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
74
69
## GetStatus
75
70
76
71
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
78
73
GetStatus() after process initialization and before using Windows App Runtime content (e.g. in
79
- main () or WinMain()).
74
+ Main () or WinMain()).
80
75
81
76
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.
83
78
84
79
``` C#
85
80
DeploymentResult result = DeploymentManager .GetStatus ();
@@ -98,15 +93,17 @@ architecture are derived from the current framework package loaded.
98
93
99
94
## Initialize
100
95
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
102
97
the required version, it will attempt to deploy those packages and get the WindowsAppRuntime into an
103
98
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
110
107
[ developer docs] ( https://docs.microsoft.com/windows/apps/windows-app-sdk/deploy-packaged-apps#address-installation-errors )
111
108
for instructions on how to handle errors.
112
109
@@ -115,9 +112,10 @@ concern to some developers. To address these concerns, developers can instead ca
115
112
and verify that the required packages are missing. If so, then call Initialize() on another thread
116
113
to handle the time delay more elegantly.
117
114
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.
121
119
122
120
``` C#
123
121
if (DeploymentManager .GetStatus ().Status != DeploymentStatus .Ok )
@@ -133,7 +131,7 @@ again.
133
131
// Check the result.
134
132
if (initializeTask .Result .Status != DeploymentStatus .Ok )
135
133
{
136
- // The WindowsAppRuntime is in a bad state which Initialize() did not fix .
134
+ // The Initialize() has failed .
137
135
// Do error reporting or gather information for submitting a bug.
138
136
// Gracefully exit the program or carry on without using the WindowsAppRuntime.
139
137
}
@@ -152,13 +150,13 @@ by using DeploymentInitializeOptions object and setting ForceDeployment option b
152
150
this API. This option when set will shut down the application(s) associated with WinAppSDK packages,
153
151
update the WinAppSDK packages and restart the application(s).
154
152
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.
157
155
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
159
157
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.
162
160
163
161
``` C#
164
162
if (DeploymentManager .GetStatus ().Status != DeploymentStatus .Ok )
@@ -179,7 +177,7 @@ they shut down, to refer to the updated framework package.
179
177
// Check the result.
180
178
if (initializeTask .Result .Status != DeploymentStatus .Ok )
181
179
{
182
- // The WindowsAppRuntime is in a bad state which Initialize() did not fix .
180
+ // The Initialize() has failed .
183
181
// Do error reporting or gather information for submitting a bug.
184
182
// Gracefully exit the program or carry on without using the WindowsAppRuntime.
185
183
}
@@ -188,19 +186,26 @@ they shut down, to refer to the updated framework package.
188
186
189
187
## Repair
190
188
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.
198
203
199
204
``` C#
200
- if (DeploymentManager .GetStatus ().Status ! = DeploymentStatus .Ok )
205
+ if (DeploymentManager .GetStatus ().Status = = DeploymentStatus .Ok )
201
206
{
202
207
// 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
204
209
// status check, Repair can sometimes take several seconds to deploy the packages.
205
210
// These should be run on a separate thread so as not to hang your app while the
206
211
// packages deploy.
@@ -210,7 +215,7 @@ contain the error, if one occurs during package install.
210
215
// Check the result.
211
216
if (repairTask .Result .Status != DeploymentStatus .Ok )
212
217
{
213
- // The WindowsAppRuntime is in a bad state which Repair() did not fix .
218
+ // The Repair() has failed .
214
219
// Do error reporting or gather information for submitting a bug.
215
220
// Gracefully exit the program or carry on without using the WindowsAppRuntime.
216
221
}
@@ -226,13 +231,14 @@ namespace Microsoft.Windows.ApplicationModel.WindowsAppRuntime
226
231
apicontract DeploymentContract{};
227
232
228
233
/// Represents the current Deployment status of the WindowsAppRuntime
229
- [contract (DeploymentContract , 1 )]
234
+ [contract (DeploymentContract , 3 )]
230
235
enum DeploymentStatus
231
236
{
232
237
Unknown = 0 ,
233
238
Ok ,
234
239
PackageInstallRequired ,
235
240
PackageInstallFailed ,
241
+ PackageRepairFailed ,
236
242
};
237
243
238
244
/// Represents the result of a Deployment Manager method.
@@ -256,7 +262,7 @@ namespace Microsoft.Windows.ApplicationModel.WindowsAppRuntime
256
262
DeploymentInitializeOptions ();
257
263
258
264
/// 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
260
266
/// currently in use, when registering the WinAppSDK packages.
261
267
Boolean ForceDeployment ;
262
268
};
0 commit comments