且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么文件被放置在“C:\Users\AppData\Local\VirtualStore\Program Files(x86)"中?

更新时间:2023-08-26 11:20:22

我的猜测是您的清单显示为 asInvoker,并且您的应用程序尝试写入程序文件.当用户在没有清单的情况下运行它时,它会写入 Program Files 的虚拟存储,这是他们后来找到一些文件的路径.当他们使用清单运行时,它根本无法写入(访问被拒绝),但是您的应用程序向他们隐藏了错误,或者他们不理解错误,因此他们没有向您提及.

My guess is that your manifest says asInvoker, and that your app tries to write to Program Files. When the users ran it without a manifest, it wrote to the virtual store for Program Files, which is the path where they found some files later. When they ran with a manifest, it failed to write at all (with access denied) but either your application hid the error from them, or they didn't understand the error so they didn't mention it to you.

短期修复 - 使用 requireAdministrator 清单.这会激怒用户,但写入会成功.长期修复 - 不要写入 ProgramFiles.有更好的每用户选项,例如 AppData.

Short term fix - use a requireAdministrator manifest. This will irritate the users but the writes will succeed. Longer term fix - don't write to ProgramFiles. There are better per-user options, like AppData.