简体   繁体   English

如何在 Visual Studio 2010 中查找和删除所有未使用的资源?

[英]How to find and remove all unused resources in Visual Studio 2010?

Is there a way to find all unused resources (those that have x:Key attribute set)?有没有办法找到所有未使用的资源(那些设置了 x:Key 属性的资源)? By resources I mean the WPF/XAML objects created in ResourceDictionary.我所说的资源是指在 ResourceDictionary 中创建的 WPF/XAML 对象。 This is WPF/XAML specific question, not related to.resx files or other kind of resources such as images or binary files.这是 WPF/XAML 特定问题,与 .resx 文件或其他类型的资源(如图像或二进制文件)无关。

I have been working on a project for a while and was testing some different styles for same controls but during the time everything got mixed up so I'd like to remove all resources not used anymore.我已经在一个项目上工作了一段时间,并且正在为相同的控件测试一些不同的 styles 但在此期间一切都变得混乱所以我想删除所有不再使用的资源。

You could do a file search (using Find in Files ) across your solution for each of your named resources.您可以在解决方案中为每个命名资源进行文件搜索(使用Find in Files )。 Not very elegant, but it will do the job.不是很优雅,但它会完成这项工作。

See this question for some assistance in finding all of the resources in your application.请参阅问题以获取有关查找应用程序中所有资源的一些帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM