-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed to CommandLineParser. Added help & README.md.
- Loading branch information
ggrignoli
committed
Sep 24, 2017
1 parent
22848ea
commit 751ee0b
Showing
6 changed files
with
68 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Create a Visual Studio Solution from Existing Projects | ||
|
||
This console application traverse a folder tree finding every existing Visual Studio Project and adding them to a new solution. It creates 'solution folders' so the projects are grouped in the same hierarchy as in the file system. | ||
|
||
Usage: | ||
``` | ||
-f, --folder Required. Folder to traverse and where the solution will be | ||
generated. | ||
-o, --output (Default: AllProjects.sln) FileName of the solution to | ||
create. | ||
-e, --exclude (Default: .git,bin,obj,packages,node_modules) Comma | ||
separated list of folders to exclude. | ||
-v, --verbose Verbose | ||
``` | ||
|
||
Example: | ||
``` | ||
SolutionGenerator.exe --folder C:\git\SomeSolutionRoot --output MySolutionFile.sln | ||
``` | ||
|
||
## Supported Project Types: | ||
Right now it only supports *.csproj file types. It can be extended to other project types by correctly handling the each Project Type GUIDs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,32 @@ | ||
using Fclp; | ||
using CommandLine; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
[assembly: CommandLine.AssemblyUsageAttribute("Finds all Visual Studio projects in a folder tree and adds them to a new solution file.")] | ||
|
||
namespace SolutionGenerator | ||
{ | ||
public class Arguments | ||
public class Options | ||
{ | ||
[Option('f', "folder", HelpText = "Folder to traverse and where the solution will be generated.", Required = true)] | ||
public string Folder { get; set; } | ||
[Option('o', "output", HelpText = "FileName of the solution to create.", DefaultValue = "AllProjects.sln")] | ||
public string SolutionFileName { get; set; } | ||
[Option('e', "exclude", HelpText = "Comma separated list of folders to exclude.", DefaultValue = ".git,bin,obj,packages,node_modules")] | ||
public string ExcludedFolders { get; set; } | ||
[Option('v', "verbose", HelpText = "Verbose")] | ||
public bool Verbose { get; set; } | ||
|
||
} | ||
|
||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
var parser = new FluentCommandLineParser<Arguments>(); | ||
|
||
parser.Setup(a => a.Folder) | ||
.As('f', "folder") | ||
.SetDefault(Directory.GetCurrentDirectory()); | ||
|
||
parser.Setup(a => a.SolutionFileName) | ||
.As('d', "dest") | ||
.Required(); | ||
|
||
var result = parser.Parse(args); | ||
|
||
if (result.HasErrors) | ||
{ | ||
Console.WriteLine( result.ErrorText); | ||
Console.Read(); | ||
return; | ||
} | ||
|
||
parser.Object.Folder = Path.GetFullPath(parser.Object.Folder); | ||
|
||
new SolutionGenerator(parser.Object).Render(); | ||
var options = new Options(); | ||
var isValid = Parser.Default.ParseArgumentsStrict(args, options); | ||
if (isValid) | ||
new SolutionGenerator(options).Render(); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="FluentCommandLineParser" version="1.4.3" targetFramework="net46" /> | ||
<package id="CommandLineParser" version="1.9.71" targetFramework="net46" /> | ||
</packages> |