@@ -6,9 +6,9 @@ This is the spec for proposal
6
6
The Windows App SDK (WinAppSDK) for packaged apps involves the framework, main, and singleton
7
7
packages, which are all signed and published by Microsoft. The framework package contains the
8
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 push notifications, and it
10
- is also needed for the framework to be serviced by the Microsoft Store. The singleton package
11
- supports a single long-running process that is brokered between apps for features like push
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
12
notifications.
13
13
14
14
Currently, packaged apps can only declare dependencies on WinAppSDK framework package. In order to
@@ -42,12 +42,13 @@ are already present on the system, or that the version present is the minimum ve
42
42
the application. Instead, the Deployment API should be used to validate that the WinAppSDK is at the
43
43
correct version and that all required packages are present.
44
44
45
- The Deployment API addresses the following two developer scenarios:
45
+ The Deployment API addresses the following three developer scenarios:
46
46
47
47
1 . Does this system have the min version of the WinAppSDK main and singleton packages required by my
48
48
app?
49
49
2 . How do I install the WinAppSDK main and singleton packages, if they are not already present on
50
50
the system?
51
+ 3 . How do I repair the already installed WinAppSDK main and singleton pacakges, if needed ?
51
52
52
53
The API addresses #1 by a simple query of the version needed and a check for OS updates.
53
54
@@ -60,6 +61,14 @@ The API addresses #1 by a simple query of the version needed and a check for OS
60
61
packageManagement restricted capability can use the Deployment API to get these packages
61
62
installed.
62
63
64
+ #3 has two possible answers.
65
+
66
+ - First, the developer can repair these packages directly through the app by reinstalling them, if
67
+ possible. These MSIX packages can be acquired through
68
+ [ Downloads page] ( https://docs.microsoft.com/windows/apps/windows-app-sdk/downloads ) .
69
+ - Alternatively, unpackaged apps that are full trust or MSIX packaged apps that have the
70
+ packageManagement restricted capability can use the Deployment API to get these packages repair.
71
+
63
72
# Examples
64
73
65
74
## GetStatus
@@ -143,10 +152,8 @@ by using DeploymentInitializeOptions object and setting ForceDeployment option b
143
152
this API. This option when set will shut down the application(s) associated with WinAppSDK packages,
144
153
update the WinAppSDK packages and restart the application(s).
145
154
146
- // OPENISSUE: If this option is set when updating main package, then whether the out of process com
147
- server from the main package such as push Notifications needs to be explicitly restarted needs to be
148
- understood. If restart it is needed, then the API will handle explicitly restarting it. This is
149
- under investigation.
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.
150
157
151
158
When the API is updating framework package and ForceDeployment option is set, then all dependent
152
159
packages that are NOT currently in use will be immediately re-installed to refer to the updated
@@ -179,12 +186,43 @@ they shut down, to refer to the updated framework package.
179
186
}
180
187
```
181
188
189
+ ## Repair
190
+
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.
198
+
199
+ ``` C#
200
+ if (DeploymentManager .GetStatus ().Status != DeploymentStatus .Ok )
201
+ {
202
+ // 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
204
+ // status check, Repair can sometimes take several seconds to deploy the packages.
205
+ // These should be run on a separate thread so as not to hang your app while the
206
+ // packages deploy.
207
+ var repairTask = Task .Run (() => DeploymentManager .Repair ());
208
+ repairTask .Wait ();
209
+
210
+ // Check the result.
211
+ if (repairTask .Result .Status != DeploymentStatus .Ok )
212
+ {
213
+ // The WindowsAppRuntime is in a bad state which Repair() did not fix.
214
+ // Do error reporting or gather information for submitting a bug.
215
+ // Gracefully exit the program or carry on without using the WindowsAppRuntime.
216
+ }
217
+ }
218
+ ```
219
+
182
220
# API Details
183
221
184
222
``` C# (but really MIDL3)
185
223
namespace Microsoft .Windows .ApplicationModel .WindowsAppRuntime
186
224
{
187
- [contractversion (2 )]
225
+ [contractversion (3 )]
188
226
apicontract DeploymentContract{};
189
227
190
228
/// Represents the current Deployment status of the WindowsAppRuntime
@@ -241,6 +279,11 @@ namespace Microsoft.Windows.ApplicationModel.WindowsAppRuntime
241
279
[contract (DeploymentContract , 2 )]
242
280
[overload (" Initialize" )]
243
281
static DeploymentResult Initialize (Microsoft .Windows .ApplicationModel .WindowsAppRuntime .DeploymentInitializeOptions deploymentInitializeOptions );
282
+
283
+ /// Checks the status of the WindowsAppRuntime of the current package and attempts to
284
+ /// repair already installed WinAppSDK packages.
285
+ [contract (DeploymentContract , 3 )]
286
+ static DeploymentResult Repair ();
244
287
};
245
288
}
246
289
```
0 commit comments