I\'ve got alot of projects and I don\'t have a master solution with everything in it. The reason I want one is for refactoring.
So I was wondering if anybody knew a
Check out nAnt, the .NET port of Ant. It has the ability to do stuff like this, or to build without it.
I've programmatically using text manipulation created solution files for .vcproj files (but cs/vb would work just the same). It isn't really hard to figure out how to do it if you open up a solution file in notepad or whatever.
Unfortunately I cannot provide the code as it is proprietary.
You can try this (the code below comes from this site, of all sites..)
But if it doesn't work and it would take too much time to debug, I would suggest going for the pain of adding them manually once. Just put some good music and go for it... :)
@oefe I don't think VS.NET allows you to D&D projects into solutions, I've tried that once.
Imports EnvDTE
Imports EnvDTE80
-----------------------------------------------------------------------------------
Private Shared Sub DoStuff()
Dim filePath As String = "c:\temp"
Dim fileName As String = "bld_TestApp.sln"
Dim fullName As String = Path.Combine(filePath, fileName)
Dim objType As Type
Dim objDTE As EnvDTE.DTE
objType = Type.GetTypeFromProgID("VisualStudio.DTE.8.0")
objDTE = DirectCast(System.Activator.CreateInstance(objType), EnvDTE.DTE)
Console.WriteLine(objDTE.Name + ":" + objDTE.Version)
objDTE.Solution.Create(filePath, fileName)
objDTE.Solution.AddFromFile("C:\Common.vbproj")
objDTE.Solution.SaveAs(fullName)
End Sub
Vagif Abilov wrote a wonderful utility that will generate a solution file from project files. It is amazing if you are working for people who don't "believe" in solution files. ugh.
GenerateSolutionFile.exe
Usage: GenerateSolutionFile /p /s [/i includeFilter] [/e excludeFilter]
http://bloggingabout.net/blogs/vagif/archive/2009/08/04/utility-to-generate-visual-studio-solution-file-for-a-group-of-projects.aspx
In 2018, you can use dotnet sln command to add project to an existing solution and dotnet new sln to create a new one.
To add all projects from current folder use these commands in PowerShell
dotnet new sln
Get-ChildItem -Recurse *.csproj | ForEach { dotnet sln add $_.FullName }
Create an empty solution, then drag & drop all your projects into it at once?