C# - Convert multi-project solutions to 1-1 solution to project
Let's say开发者_C百科 I have a single solution file that references N project files. There's a 1-N relationship of solution to project files.
How can I make a script that makes N solution files, each of which points to a distinct project file?
Example: I've got A.sln that points to a.csproj, b.csproj, and c.csproj. What's a good way to make a script that will create two more solution files, B.sln and C.sln?
Here's what I have in mind:
fn(Solution f)
{
projectArray = f.getAllProjects;
for each project in projectArray
{
Solution s = new Solution(project); // makes new solution with name and
// reference to project
s.copySettings(f); // copy all of f minus the project references
s.save(); // save new Solution
}
delete f;
}
You can try to parse .sln file manually. You can read about .sln file format in the article Hack the Project and Solution Files
精彩评论