Skip to content

Commit 704bb83

Browse files
JusterZhuclaude
andauthored
docs: merge guide pages into Deployment & Operations, remove FAQ (#90)
- Merge Permission, File occupancy, Dump, and Packaging into a single comprehensive 'Deployment & Operations Guide' covering: patch generation, client packaging, platform-specific deployment, CI/CD integration, Windows UAC permissions, file occupancy troubleshooting, crash dump diagnostics, and version management - Remove FAQ page (content covered elsewhere or available in docs) - Update cross-references in Bowl, Differential, Extension docs - Update sidebar label from 'Help' to 'Deployment & Operations' - Apply changes across all 3 locale layers (zh-Hans default, en, zh-Hans i18n) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent c9433dc commit 704bb83

26 files changed

Lines changed: 1064 additions & 1691 deletions

website/docs/doc/GeneralUpdate.Bowl.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,4 +417,4 @@ MyApp/
417417

418418
- [Bowl 示例代码](https://github.com/GeneralLibrary/GeneralUpdate-Samples/tree/main/src/Bowl)
419419
- [GeneralUpdate 仓库](https://github.com/GeneralLibrary/GeneralUpdate)
420-
- [Dump 指南](../guide/Dump)
420+
- [Dump 指南](../guide/Deployment and Operations)

website/docs/doc/GeneralUpdate.Differential.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,4 +364,4 @@ await new GeneralUpdateBootstrap()
364364
- [GeneralUpdate 仓库](https://github.com/GeneralLibrary/GeneralUpdate)
365365
- [Samples 差分示例](https://github.com/GeneralLibrary/GeneralUpdate-Samples/tree/main/src/Hub/Samples/DifferentialSample.cs)
366366
- [Core DiffPipeline 文档](GeneralUpdate.Core)
367-
- [Tools 打包指南](../guide/Packaging)
367+
- [Tools 打包指南](../guide/Deployment and Operations)

website/docs/doc/GeneralUpdate.Extension.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,4 +676,4 @@ report-extension_1.0.0.zip
676676

677677
- [扩展管理示例](https://github.com/GeneralLibrary/GeneralUpdate-Samples/tree/main/src/Hub/Samples/ExtensionSample.cs)
678678
- [GeneralUpdate 仓库](https://github.com/GeneralLibrary/GeneralUpdate)
679-
- [打包指南](../guide/Packaging)
679+
- [打包指南](../guide/Deployment and Operations)

website/docs/guide/Packaging.md renamed to website/docs/guide/Deployment and Operations.md

Lines changed: 167 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
sidebar_position: 6
2+
sidebar_position: 1
33
---
44

5-
# 打包与部署
5+
# 部署与运维指南
66

7-
本文档介绍如何将应用程序与其更新系统打包,分发给最终用户
7+
本文档涵盖应用程序打包部署、平台适配、故障排查和运维诊断
88

99
---
1010

@@ -120,7 +120,7 @@ await new GeneralUpdateBootstrap()
120120
**避免 C 盘权限问题:**
121121

122122
- 建议默认安装到 `%LOCALAPPDATA%` 而非 `C:\Program Files\`
123-
- 如必须安装在 C 盘,参考 [权限指南](./Permission) 配置注册表降权
123+
- 如必须安装在 C 盘,参考下方 [Windows 权限处理](#五windows-权限处理) 章节
124124

125125
**Windows 发布命令:**
126126

@@ -238,7 +238,167 @@ jobs:
238238
239239
---
240240
241-
## 五、版本号管理
241+
## 五、Windows 权限处理
242+
243+
### UAC 与安装目录
244+
245+
![](imgs\UAC.png)
246+
247+
使用 GeneralUpdate 进行自动更新时,如果更新目录位于 C 盘,尤其在替换文件或应用补丁时可能会遇到权限问题。Windows 11 对 C 盘某些目录的权限管理比以往更加严格。
248+
249+
以下目录可能触发权限问题:
250+
251+
| 名称 | 目录 |
252+
| --- | --- |
253+
| 系统文件夹 | C:\Windows |
254+
| 注册表配置 | C:\Windows\System32\config |
255+
| 驱动文件夹 | C:\Windows\System32\drivers |
256+
| 程序文件夹 | C:\Program Files 和 C:\Program Files (x86) |
257+
258+
推荐的避免权限问题的目录:
259+
260+
| 名称 | 目录 |
261+
| --- | --- |
262+
| 用户数据目录 | AppData |
263+
| 系统临时目录 | Temp |
264+
265+
### 降低 UAC 级别
266+
267+
> **警告:** 以下方法不建议在生产环境中使用,可能对用户造成安全风险。
268+
269+
如果在更新过程中遇到 UAC 弹窗或权限拒绝问题,可考虑通过修改注册表降低 UAC 控制级别:
270+
271+
| 注册表项 | 新值 | 默认值 |
272+
| --- | --- | --- |
273+
| enableLUA | 0 | 1 |
274+
| ConsentPromptBehaviorAdmin | 0 | 5 |
275+
276+
更新前修改以上注册表(重启电脑后生效),更新完成后务必恢复原值。
277+
278+
**C# 修改注册表:**
279+
280+
```csharp
281+
using Microsoft.Win32;
282+
283+
public void UpdateRegistry()
284+
{
285+
const string keyName = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System";
286+
287+
using (RegistryKey key = Registry.LocalMachine.OpenSubKey(keyName, true))
288+
{
289+
if (key != null)
290+
{
291+
key.SetValue("EnableLUA", 0, RegistryValueKind.DWord);
292+
key.SetValue("ConsentPromptBehaviorAdmin", 0, RegistryValueKind.DWord);
293+
}
294+
}
295+
}
296+
```
297+
298+
**批处理脚本修改注册表:**
299+
300+
```bat
301+
@echo off
302+
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v EnableLUA /t REG_DWORD /d 0 /f
303+
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v ConsentPromptBehaviorAdmin /t REG_DWORD /d 0 /f
304+
```
305+
306+
**参考链接:**
307+
- [User Account Control 工作原理](https://learn.microsoft.com/zh-cn/windows/security/application-security/application-control/user-account-control/how-it-works)
308+
- [Windows 用户账户控制](https://blog.walterlv.com/post/windows-user-account-control.html)
309+
310+
---
311+
312+
## 六、文件占用排查
313+
314+
### Windows 平台
315+
316+
即使应用在自动升级前已关闭,在特殊情况下(如后台服务未退出)仍可能出现文件占用。此时可使用微软的 **handle.exe** 工具检查指定目录下是否有进程在运行。
317+
318+
`handle.exe` 是 Microsoft Sysinternals 提供的命令行工具,用于显示哪些进程打开了指定文件。在 C# 中可通过 `System.Diagnostics.Process` 调用。
319+
320+
```csharp
321+
using System;
322+
using System.Diagnostics;
323+
324+
class Program
325+
{
326+
static void Main()
327+
{
328+
Process process = new Process();
329+
process.StartInfo.FileName = "handle.exe";
330+
process.StartInfo.Arguments = "filename"; // 替换为实际的文件或目录路径
331+
process.StartInfo.UseShellExecute = false;
332+
process.StartInfo.RedirectStandardOutput = true;
333+
process.Start();
334+
335+
string output = process.StandardOutput.ReadToEnd();
336+
Console.WriteLine(output);
337+
338+
process.WaitForExit();
339+
}
340+
}
341+
```
342+
343+
**如果仍存在文件占用:**
344+
1. 检查是否有后台服务未关闭
345+
2. 使用 `handle.exe` 排查占用进程
346+
3. 考虑使用强制终止或重启后更新策略
347+
348+
**参考链接:**
349+
- [Handle - Sysinternals](https://learn.microsoft.com/zh-cn/sysinternals/downloads/handle)
350+
351+
---
352+
353+
## 七、崩溃转储诊断
354+
355+
在自动更新过程中,如果更新失败或更新后程序崩溃,可使用 **ProcDump** 工具导出 dump 文件进行分析。
356+
357+
ProcDump 是 Microsoft Sysinternals 的命令行实用工具,主要用于监控应用程序的 CPU 峰值并在峰值期间生成崩溃转储。管理员或开发人员可使用这些转储来确定崩溃原因。ProcDump 还支持挂起窗口监控、未处理异常监控,并可基于系统性能计数器值生成转储。
358+
359+
### C# 调用 ProcDump
360+
361+
```csharp
362+
using System;
363+
using System.Diagnostics;
364+
365+
public class Program
366+
{
367+
public static void Main()
368+
{
369+
var procDumpPath = @"C:\Path\To\procdump.exe";
370+
var processId = 1234; // 需要 dump 的进程 ID
371+
var dumpFilePath = @"C:\Path\To\dumpfile.dmp";
372+
373+
var startInfo = new ProcessStartInfo
374+
{
375+
FileName = procDumpPath,
376+
Arguments = $"-ma {processId} {dumpFilePath}",
377+
UseShellExecute = false,
378+
RedirectStandardOutput = true,
379+
RedirectStandardError = true,
380+
CreateNoWindow = true
381+
};
382+
383+
var process = new Process { StartInfo = startInfo };
384+
process.OutputDataReceived += (sender, e) => Console.WriteLine(e.Data);
385+
process.ErrorDataReceived += (sender, e) => Console.Error.WriteLine(e.Data);
386+
387+
process.Start();
388+
process.BeginOutputReadLine();
389+
process.BeginErrorReadLine();
390+
391+
process.WaitForExit();
392+
}
393+
}
394+
```
395+
396+
**参考链接:**
397+
- [ProcDump - Sysinternals](https://learn.microsoft.com/zh-cn/sysinternals/downloads/procdump)
398+
399+
---
400+
401+
## 八、版本号管理
242402

243403
### 推荐策略
244404

@@ -261,7 +421,7 @@ jobs:
261421

262422
---
263423

264-
## 六、检查清单
424+
## 九、部署检查清单
265425

266426
部署前确认:
267427

@@ -280,6 +440,5 @@ jobs:
280440
## 相关资源
281441

282442
- **[GeneralUpdate.Tools](../quickstart/GeneralUpdate.PacketTool)** — 补丁包和配置生成工具
283-
- **[权限指南](./Permission)** — Windows UAC 权限处理
284-
- **[入门实战手册](../quickstart/Beginner%20cookbook)** — 从零跑通更新闭环
443+
- **[入门实战手册](../quickstart/Beginner cookbook)** — 从零跑通更新闭环
285444
- **[GeneralUpdate.Core](../doc/GeneralUpdate.Core)** — 核心更新引擎架构

website/docs/guide/Dump.md

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)