如何卸载 Win32 程序集并清理 WinSxS?
经过大量试验和错误(主要是由于缺乏文档和示例),我成功创建了 MSI 安装程序,将自定义 DLL 作为并行程序集安装到 WinSxS。 只有一个问题:卸载会将所有文件(DLL、清单和目录)留在 WinSxS 目录中。 我怎样才能或应该最好地清理它? 我确信没有其他任何东西引用它。
我在某处读到 WinSxS 有一个自清理过程,可以随着时间的推移进行清理,但我找不到更多相关信息。 您可以手动调用它来清理东西吗?
我看到的唯一其他方法是手动删除这些位。 首先,您必须将所有文件(程序集、目录、清单及其各自的目录)的所有者从 SYSTEM 更改为管理员帐户,调整权限并删除它们。 注册表中还剩下一些片段(我认为 HKLM\COMPONENTS\DerivedData\Components 可能是一个地方),但由于 WinSxS 应该被视为不透明,因此很难找到任何信息。
After a lot of trial and error (mostly due to lack of documentation and examples) I have managed to create MSI installers that install custom DLLs to WinSxS as side-by-side assembly. There is only one problem: Uninstalling leaves all files (DLLs, manifests and catalogs) in the WinSxS directory. How can or should I best clean that up? I know for sure that nothing else references it.
I have read somewhere that WinSxS has a self-scavenging process that cleans up over time but I could not find more information about that. Can you manually invoke this to clean up stuff?
The only other way I see is manually deleting those bits. First you have to change the owner of all files (assembly, catalog, manifest and their respective directory) from SYSTEM to an administrator account, adjust the permissions and delete them. There are also pieces left in the registry (I think HKLM\COMPONENTS\DerivedData\Components may be one place), but since WinSxS should be treated as opaque it is hard to find any information.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
据我所知,拾荒行为并没有暴露在任何地方。 我什至不确定它什么时候自动启动。 也许是在卸载服务包时? 也许一些工具管理员可以运行? 我真的忘记了。
无论如何,我的建议是不要反抗。 那里有太多曲折的转弯,根本不值得尝试恢复磁盘空间。 一旦卸载,仍在 SxS 缓存中的位将不会被激活,因此它们只是浪费空间。
这是一个愚蠢的设计,但归咎于微软,不要试图过度补偿。
Scavenging isn't exposed anywhere that I know of. I'm not even sure when it is kicked off automatically. Maybe on uninstall of a service pack? Maybe some tool admins can run? I really forget.
Anyway, my suggestion is don't fight it. There are so many twisty turns down there that it just isn't worth trying to get the disk space back. Once uninstalled the bits still in the SxS cache will not be activated so they are just wasting space.
It's a dumb design but blame Microsoft and don't try to overcompensate.
这是文章,它是 WinSxS 的完整指南。
因此,很快,您只能卸载一些组件(它们的所有版本都在此文件夹中),并且您可以运行Service Pack桥刻录实用程序(在Vista中,它被命名为VSP1CLN.EXE并随SP1一起提供)。 请注意,执行后,您不应该能够在 SP 发布日期之前卸载 SP 或声明的任何组件。
Here is an article, it's kinda complete guide to WinSxS.
So, shortly, you can only uninstall some components (all their versions are in this folder), and you can run Service Pack bridge burning utility (in Vista it is named VSP1CLN.EXE and shipped with SP1). Note, that after execution, you shouldn't be able to uninstall SP or any components to state, prior to SP release date.
没有人相信您可以 - 除非完全重新安装,否则您臃肿的 WinSxS 目录将保留下来。
已经有很长一段时间了"在 technet 上对该问题进行讨论。
没有该格式的文档,也没有任何说明如何删除不再需要的文件 - MS 似乎认为磁盘空间很便宜。 有一个自我清除功能,但没有人相信它有效,或者即使有效,它也是非常保守的(正如您所希望的,因为您不希望它破坏您的操作系统)
您可以看出清除程序是通过检查“C:\Windows\winsxs\Temp\PendingDeletes”来工作。 文件夹,因为这是 Windows 更新或安装程序将文件移动到的位置 - 清理程序只是删除此处的文件。
No-one is convinced you can - short of a complete reinstall, your bloaty WinSxS directory is there to stay.
There's been a long "discussion" of the problem on technet.
There is no documentation of the format, or any instructions how to remove files that are no longer needed - MS seems to think that disc space is cheap. There is a self-scavenging feature, but no-one's convinced it works, or if it does, it is very conservative (as you'd hope as you don't want it to break your OS)
You can tell is the scavenger is working by checking the "C:\Windows\winsxs\Temp\PendingDeletes." folder, as this is where files are moved by windows update or an installer moves them to - the scavenger just deletes the files in here.
您会注意到,卸载程序集后,虽然文件仍然存在,但它们不能再绑定 - 因此它们只是“暂存”或缓存,但并未真正安装。
罗布& gbjbaanb 是正确的 - 您不能自己手动调用 scavenge。 不要尝试自己删除这些文件 - 注册表中有多个位置注册了这些文件,DerivedData\Components 只是众多引用之一。
我认为 Vista 的规则是在机器不活动 10 分钟后、在最后一次服务操作(服务包、修补程序等)之后,由 TrustedInstaller 服务启动清理工作。 但它非常变化无常,因此它不会像应有的那样频繁运行。 所以只要耐心等待,文件就会自行消失。
You'll notice that after you uninstall your assembly, while the files are still there, they can no longer be bound to - so they are just "staged", or cached, but not really installed.
Rob & gbjbaanb are correct - you cannot manually invoke a scavenge yourself. Don't try to delete the files yourself - there are multiple places in the registry where they are registered, DerivedData\Components being only one of the many references.
I think the rule for Vista is scavenging is kicked off by the TrustedInstaller service after 10 minutes of machine inactivity, after the last servicing operation (service pack, hotfix, etc). But it's very fickle, so it doesn't run as often as it should. So just be patient, and the files will disappear on their own.
好吧,我遇到了一些问题,因为我的 Windows 配备了 80GB SSD,而 WinSxs 文件夹大约有 12GB,
我在网上搜索时发现了这个命令:
现在我的 WinSxs 是 7GB,这是个好消息。
Well i was having some issues as i have an 80GB SSD for my windows and the WinSxs folder was about 12gb's
I was searching the net and i found this command:
And now my WinSxs is 7gb which was wonderful news.
有关适用于较新操作系统的清理方法的一些更新。 检查 http://www.karafilis.net/winsxs-cleanup
There are a few updates regarding the cleanup method that apply to newer OS. Check http://www.karafilis.net/winsxs-cleanup