You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/i18n/en/docusaurus-plugin-content-docs/current/doc/GeneralUpdate.Core.md
+130-1Lines changed: 130 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -175,7 +175,7 @@ public GeneralUpdateBootstrap SetSource(
175
175
string?token=null)
176
176
```
177
177
178
-
`SetSource` is a lightweight entry point when identity metadata is discovered elsewhere, such as from `generalupdate.manifest.json`.
178
+
`SetSource` is a lightweight entry point when identity metadata is discovered elsewhere, such as from `generalupdate.manifest.json`. When you need precise control over every manifest identity field, prefer `ManifestInfo.Load().ToUpdateRequest()` followed by `SetConfig(request)`.
179
179
180
180
```csharp
181
181
awaitnewGeneralUpdateBootstrap()
@@ -281,6 +281,134 @@ var request = new UpdateRequestBuilder()
`generalupdate.manifest.json` is the application identity manifest generated by `GeneralUpdate.Tools` and consumed by Core. It moves stable metadata such as the main executable name, current version, updater executable name, product ID, and updater directory out of code configuration. Application code can then focus on runtime and sensitive values such as server URLs, secrets, and tokens.
287
+
288
+
Place the file in the application install directory, the same directory referenced by `UpdateRequest.InstallPath`. By default, `InstallPath` is `AppDomain.CurrentDomain.BaseDirectory`, so desktop applications normally place the manifest in the main app output root.
289
+
290
+
```text
291
+
MyProduct/
292
+
├─ ClientSample.exe
293
+
├─ generalupdate.manifest.json
294
+
└─ update/
295
+
└─ UpgradeSample.exe
296
+
```
297
+
298
+
### Manifest structure
299
+
300
+
The JSON generated by Tools uses camelCase property names. The Core-side type is `ManifestInfo`.
301
+
302
+
```json
303
+
{
304
+
"mainAppName": "ClientSample.exe",
305
+
"clientVersion": "1.0.0",
306
+
"appType": "Client",
307
+
"updateAppName": "UpgradeSample.exe",
308
+
"upgradeClientVersion": "1.0.0",
309
+
"productId": "sample-product",
310
+
"updatePath": "update/"
311
+
}
312
+
```
313
+
314
+
| JSON field | Core field | Description |
315
+
| --- | --- | --- |
316
+
|`mainAppName`|`MainAppName`| Main application executable name. Used to restart the app after update and identify the current product. |
317
+
|`clientVersion`|`ClientVersion`| Current main application version. Core sends it to the server to check whether a main-app update exists. |
318
+
|`appType`|`AppType`| Current process role, such as `Client`, `Upgrade`, `OssClient`, or `OssUpgrade`. |
319
+
|`updateAppName`|`UpdateAppName`| Updater executable name. Defaults to `Update.exe`. |
320
+
|`upgradeClientVersion`|`UpgradeClientVersion`| Updater application's own version. Core uses it to decide whether the updater must be updated first. |
321
+
|`productId`|`ProductId`| Product identifier for servers that manage multiple products. |
322
+
|`updatePath`|`UpdatePath`| Directory containing the updater. It can be relative to `InstallPath`, for example `update/`. |
323
+
324
+
The manifest intentionally does not include `UpdateUrl`, `ReportUrl`, `AppSecretKey`, `Scheme`, or `Token`. This keeps Tools responsible for build-time identity metadata while secrets still come from application code, a configuration service, or the deployment environment.
325
+
326
+
### How Tools generates the manifest
327
+
328
+
The `GeneralUpdate.Tools` configuration flow parses the main-app and updater `.csproj` files, validates version values, and emits `generalupdate.manifest.json`.
329
+
330
+
| Tools step | Responsibility |
331
+
| --- | --- |
332
+
|`CsprojParseStep`| Parses the main application `.csproj`; if an updater `.csproj` is provided, parses it as well. |
333
+
|`SemverValidateStep`| Validates that `ClientVersion` and `UpgradeClientVersion` use semver, for example `1.0.0`. |
334
+
|`ManifestBuildStep`| Fills missing `MainAppName` / `UpdateAppName` from `.csproj``AssemblyName` values. |
335
+
|`FileEmitStep`| Writes the manifest to the output directory with the fixed name `generalupdate.manifest.json`. |
336
+
337
+
The sample publishing flow in the configuration UI also calls `SamplePublisherService.PublishAsync(...)` to place the main-app output, updater output, and manifest into one runnable sample directory. New users therefore do not need to hand-write a complete `UpdateRequest`: they can generate the manifest with Tools and only add server endpoints and secrets in application code.
338
+
339
+
### How Core reads the manifest
340
+
341
+
Core provides `ManifestInfo`:
342
+
343
+
```csharp
344
+
usingGeneralUpdate.Core.Configuration;
345
+
346
+
varmanifest=ManifestInfo.Load();
347
+
if (manifest==null)
348
+
thrownewFileNotFoundException("generalupdate.manifest.json was not found.");
`ManifestInfo.Load()` reads from `AppDomain.CurrentDomain.BaseDirectory` by default. `ManifestInfo.Load(path)` reads a specific file. `ToUpdateRequest()` converts the manifest into a minimal `UpdateRequest`, but it does not populate server URLs or secrets.
363
+
364
+
At the beginning of the standard workflow, `ClientStrategy` also calls `AppMetadataDiscoverer.Discover(context)` and fills empty identity fields from `InstallPath/generalupdate.manifest.json`. The precedence rule matters: **values already provided in code win; the manifest only fills empty fields**. This lets you use the manifest as the default identity source while still overriding individual fields in special environments.
365
+
366
+
### Recommended configuration pattern
367
+
368
+
For application code, the clearest pattern is "manifest for identity, code/environment for server and secrets".
The manifest is not only read at startup. After a successful update, Core writes the new version back to the same `generalupdate.manifest.json` under the install directory:
404
+
405
+
| Scenario | Field written back |
406
+
| --- | --- |
407
+
| Main application update completed |`ClientVersion`|
On the next polling cycle or process start, Core therefore validates from the latest applied version instead of the build-time version. This requires the install directory to be writable; if the application is installed under a restricted directory, ensure the updater has permission to update the manifest file.
411
+
284
412
## Runtime options: Option
285
413
286
414
Core uses strongly typed `Option<T>` values and sets them with `SetOption`.
@@ -818,6 +946,7 @@ Core consumes manifests and packages. `GeneralUpdate.Tools` helps generate and v
0 commit comments