如何在 WiX 卸载期间删除 .NET 独立存储设置文件夹?

发布于 2024-09-02 07:49:00 字数 829 浏览 1 评论 0原文

我想删除使用 My.Settings 等时由 .NET 应用程序创建的独立存储文件夹。设置文件存储在类似于

C:\Users\%Username%\AppData\Roaming\App\App.exe_Url_r0q1rvlnrqsgjkcosowa0vckbjarici4

此问题的位置 StackOverflow:卸载 Wix 时删除文件 我可以使用以下方式卸载文件夹:

<Directory Id="AppDataFolder" Name="AppDataFolder"> 
    <Directory Id="MyAppFolder" Name="My"> 
        <Component Id="MyAppFolder" Guid="YOURGUID-7A34-4085-A8B0-8B7051905B24"> 
            <CreateFolder />
            <RemoveFile Id="PurgeAppFolder" Name="*.*" On="uninstall" /> 
        </Component> 
    </Directory> 
</Directory>

<!-- LocalAppDataFolder-->

这不支持子文件夹等。这是自定义 . NET 操作还是有更简单的方法来删除这些 .NET 生成的设置文件夹?

I would like to remove the isolated storage folders that are created by a .NET application when using My.Settings etc. The setting files are stored in a location like

C:\Users\%Username%\AppData\Roaming\App\App.exe_Url_r0q1rvlnrqsgjkcosowa0vckbjarici4

As per this question StackOverflow: Removing files when uninstalling Wix I can uninstall a folder using:

<Directory Id="AppDataFolder" Name="AppDataFolder"> 
    <Directory Id="MyAppFolder" Name="My"> 
        <Component Id="MyAppFolder" Guid="YOURGUID-7A34-4085-A8B0-8B7051905B24"> 
            <CreateFolder />
            <RemoveFile Id="PurgeAppFolder" Name="*.*" On="uninstall" /> 
        </Component> 
    </Directory> 
</Directory>

<!-- LocalAppDataFolder-->

This doesn't support sub-folders etc. Is the only option a custom .NET action or is there a more simple approach for removing these .NET generated setting folders?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一念一轮回 2024-09-09 07:49:00

是的,如果您在构建时不知道要完全填充RemoveFile 表的文件夹,那么您必须创建一个自定义操作。

您可能还会发现 WixContrib 项目很有用。它包含RemoveFolderEx扩展来解决这个问题。正如它所指出的,该代码具有中等生产质量。不过我自己从来没有尝试过...

Yep, if you don't know the folders at build time to fill in the RemoveFile table entirely, then you have to create a custom action.

You might also find the WixContrib project useful. It contains RemoveFolderEx extension to address this very problem. As it states, the code is of medium production quality. Never tried it myself, though...

时光无声 2024-09-09 07:49:00

如果有人遇到同样的问题,我使用自定义 .NET 操作来删除文件夹。 WiX 文档提供了有关如何创建操作的一个很好的示例。

If anyone is experiencing the same issue, I used a custom .NET action to remove the folders. The WiX documentation provided a good example on how to create the action.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文