I have a LARGE project in visual studio 2008. It has an accumulation of a few years of trying things out and often excluding (not deleting) files from the project. I need a way to permanently delete any excluded file. There are thousands of files and hundreds of folders. Doing it manually in solution explorer would take too much time.
我在visual studio 2008中有一个大型项目。它有几年的尝试积累,经常从项目中排除(不删除)文件。我需要一种永久删除任何排除文件的方法。有数千个文件和数百个文件夹。在解决方案资源管理器中手动执行此操作会花费太多时间。
I could build a project file parser and compare with filesystem but I'm hoping for a shortcut.
我可以构建一个项目文件解析器并与文件系统进行比较,但我希望有一个快捷方式。
Thanks
2 个解决方案
#1
Are the excluded files under source control along with the rest? If not, just make sure everything is checked in, fetch to a new temporary location, move the old directory out of the way as a backup, and move the temporary folder to where the old one was.
源代码控制下的排除文件是否与其他文件一起?如果没有,只需确保所有内容都已签入,获取到新的临时位置,将旧目录移开作为备份,并将临时文件夹移动到旧文件夹的位置。
If the experiments are checked into source control it's slightly harder - you'll probably need to go with the project file parser. That may well not be very hard though.
如果将实验检查到源代码控制中,则稍微困难一些 - 您可能需要使用项目文件解析器。但这可能不是很难。
EDIT: Okay, if it's all in SVN, I suggest you write a very crude project parser. Give it a list of XPath expressions (or something similar) to select as "probably paths". Select everything in the project file, and copy each file selected into a fresh location (including subdirectories etc). Also copy project files and solution files. Then try to build - if it fails, you've missed something: repeat.
编辑:好的,如果它全部在SVN中,我建议你写一个非常粗略的项目解析器。给它一个XPath表达式列表(或类似的东西)来选择“可能的路径”。选择项目文件中的所有内容,并将选定的每个文件复制到一个新位置(包括子目录等)。还复制项目文件和解决方案文件。然后尝试构建 - 如果失败,你错过了一些东西:重复。
Keep going until it builds, then test it. So long as everything is okay, you can then blow everything else away :)
继续前进,直到它构建,然后测试它。只要一切都好,你就可以把一切都吹走:)
EDIT: Here's the start of the kind of thing I mean:
编辑:这是我的意思的开始:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
public class ProjectParser
{
static void Main(string[] args)
{
XDocument doc = XDocument.Load(args[0]);
XNamespace ns = "http://schemas.microsoft.com/developer/msbuild/2003";
DumpMatches(doc.Descendants(ns + "Compile")
.Select(x => x.Attribute("Include").Value));
DumpMatches(doc.Descendants(ns + "AssemblyOriginatorKeyFile")
.Select(x => x.Value));
}
static void DumpMatches(IEnumerable<string> values)
{
foreach (string x in values)
{
Console.WriteLine(x);
}
}
}
(I originally tried with XPath, but the namespace stuff made it a pain.)
(我最初尝试使用XPath,但命名空间的东西让它很痛苦。)
#2
Bring up a command prompt and try DEL/S *.exclude
. I don't think you'd do much better writing an add-in to Visual Studio.
打开命令提示符并尝试DEL / S * .exclude。我认为你在编写Visual Studio加载项方面做得更好。
#1
Are the excluded files under source control along with the rest? If not, just make sure everything is checked in, fetch to a new temporary location, move the old directory out of the way as a backup, and move the temporary folder to where the old one was.
源代码控制下的排除文件是否与其他文件一起?如果没有,只需确保所有内容都已签入,获取到新的临时位置,将旧目录移开作为备份,并将临时文件夹移动到旧文件夹的位置。
If the experiments are checked into source control it's slightly harder - you'll probably need to go with the project file parser. That may well not be very hard though.
如果将实验检查到源代码控制中,则稍微困难一些 - 您可能需要使用项目文件解析器。但这可能不是很难。
EDIT: Okay, if it's all in SVN, I suggest you write a very crude project parser. Give it a list of XPath expressions (or something similar) to select as "probably paths". Select everything in the project file, and copy each file selected into a fresh location (including subdirectories etc). Also copy project files and solution files. Then try to build - if it fails, you've missed something: repeat.
编辑:好的,如果它全部在SVN中,我建议你写一个非常粗略的项目解析器。给它一个XPath表达式列表(或类似的东西)来选择“可能的路径”。选择项目文件中的所有内容,并将选定的每个文件复制到一个新位置(包括子目录等)。还复制项目文件和解决方案文件。然后尝试构建 - 如果失败,你错过了一些东西:重复。
Keep going until it builds, then test it. So long as everything is okay, you can then blow everything else away :)
继续前进,直到它构建,然后测试它。只要一切都好,你就可以把一切都吹走:)
EDIT: Here's the start of the kind of thing I mean:
编辑:这是我的意思的开始:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
public class ProjectParser
{
static void Main(string[] args)
{
XDocument doc = XDocument.Load(args[0]);
XNamespace ns = "http://schemas.microsoft.com/developer/msbuild/2003";
DumpMatches(doc.Descendants(ns + "Compile")
.Select(x => x.Attribute("Include").Value));
DumpMatches(doc.Descendants(ns + "AssemblyOriginatorKeyFile")
.Select(x => x.Value));
}
static void DumpMatches(IEnumerable<string> values)
{
foreach (string x in values)
{
Console.WriteLine(x);
}
}
}
(I originally tried with XPath, but the namespace stuff made it a pain.)
(我最初尝试使用XPath,但命名空间的东西让它很痛苦。)
#2
Bring up a command prompt and try DEL/S *.exclude
. I don't think you'd do much better writing an add-in to Visual Studio.
打开命令提示符并尝试DEL / S * .exclude。我认为你在编写Visual Studio加载项方面做得更好。