@@ -9,103 +9,103 @@ namespace ScriptCs.Hosting |
9 | 9 | { |
10 | 10 | public class VisualStudioSolution : IVisualStudioSolution |
11 | 11 | { |
12 | | - internal StringBuilder _header; |
13 | | - internal StringBuilder _projects; |
14 | | - internal StringBuilder _global; |
| 12 | + internal StringBuilder Header { get; set; } |
| 13 | + internal StringBuilder Projects { get; set; } |
| 14 | + internal StringBuilder Global { get; set; } |
15 | 15 |
|
16 | 16 | public VisualStudioSolution() |
17 | 17 | { |
18 | | - _header = new StringBuilder(); |
19 | | - _projects = new StringBuilder(); |
20 | | - _global = new StringBuilder(); |
| 18 | + Header = new StringBuilder(); |
| 19 | + Projects = new StringBuilder(); |
| 20 | + Global = new StringBuilder(); |
21 | 21 | AddHeader(); |
22 | 22 | } |
23 | 23 |
|
24 | 24 | public void AddHeader() |
25 | 25 | { |
26 | | - _header.AppendLine("Microsoft Visual Studio Solution File, Format Version 12.00"); |
27 | | - _header.AppendLine("# Visual Studio 2013"); |
28 | | - _header.AppendLine("VisualStudioVersion = 12.0.30501.0"); |
29 | | - _header.AppendLine("MinimumVisualStudioVersion = 10.0.40219.1"); |
| 26 | + Header.AppendLine("Microsoft Visual Studio Solution File, Format Version 12.00"); |
| 27 | + Header.AppendLine("# Visual Studio 2013"); |
| 28 | + Header.AppendLine("VisualStudioVersion = 12.0.30501.0"); |
| 29 | + Header.AppendLine("MinimumVisualStudioVersion = 10.0.40219.1"); |
30 | 30 | } |
31 | 31 |
|
32 | 32 | public void AddScriptcsProject(string scriptcsPath, string workingPath, string args, bool attach, Guid projectGuid) |
33 | 33 | { |
34 | | - _projects.AppendFormat(@"Project(""{{911E67C6-3D85-4FCE-B560-20A9C3E3FF48}}"") = ""scriptcs"", ""{0}"", ""{{{1}}}""{2}", scriptcsPath, projectGuid, Environment.NewLine); |
35 | | - _projects.AppendLine("\tProjectSection(DebuggerProjectSystem) = preProject"); |
36 | | - _projects.AppendLine("\t\tPortSupplier = 00000000-0000-0000-0000-000000000000"); |
37 | | - _projects.AppendFormat("\t\tExecutable = {0}{1}", scriptcsPath, Environment.NewLine); |
38 | | - _projects.AppendLine("\t\tRemoteMachine = localhost"); |
39 | | - _projects.AppendFormat("\t\tStartingDirectory = {0}{1}", workingPath, Environment.NewLine); |
40 | | - _projects.AppendFormat("\t\tArguments = {0}{1}", args, Environment.NewLine); |
41 | | - _projects.AppendLine("\t\tEnvironment = Default"); |
42 | | - _projects.AppendLine("\t\tLaunchingEngine = 00000000-0000-0000-0000-000000000000"); |
43 | | - _projects.AppendLine("\t\tUseLegacyDebugEngines = No"); |
44 | | - _projects.AppendLine("\t\tLaunchSQLEngine = No"); |
45 | | - _projects.AppendFormat("\t\tAttachLaunchAction = {0}{1}", attach == true ? "Yes" : "No", Environment.NewLine); |
46 | | - _projects.AppendLine("\tEndProjectSection"); |
47 | | - _projects.AppendLine("EndProject"); |
| 34 | + Projects.AppendFormat(@"Project(""{{911E67C6-3D85-4FCE-B560-20A9C3E3FF48}}"") = ""scriptcs"", ""{0}"", ""{{{1}}}""{2}", scriptcsPath, projectGuid, Environment.NewLine); |
| 35 | + Projects.AppendLine("\tProjectSection(DebuggerProjectSystem) = preProject"); |
| 36 | + Projects.AppendLine("\t\tPortSupplier = 00000000-0000-0000-0000-000000000000"); |
| 37 | + Projects.AppendFormat("\t\tExecutable = {0}{1}", scriptcsPath, Environment.NewLine); |
| 38 | + Projects.AppendLine("\t\tRemoteMachine = localhost"); |
| 39 | + Projects.AppendFormat("\t\tStartingDirectory = {0}{1}", workingPath, Environment.NewLine); |
| 40 | + Projects.AppendFormat("\t\tArguments = {0}{1}", args, Environment.NewLine); |
| 41 | + Projects.AppendLine("\t\tEnvironment = Default"); |
| 42 | + Projects.AppendLine("\t\tLaunchingEngine = 00000000-0000-0000-0000-000000000000"); |
| 43 | + Projects.AppendLine("\t\tUseLegacyDebugEngines = No"); |
| 44 | + Projects.AppendLine("\t\tLaunchSQLEngine = No"); |
| 45 | + Projects.AppendFormat("\t\tAttachLaunchAction = {0}{1}", attach == true ? "Yes" : "No", Environment.NewLine); |
| 46 | + Projects.AppendLine("\tEndProjectSection"); |
| 47 | + Projects.AppendLine("EndProject"); |
48 | 48 | } |
49 | 49 |
|
50 | 50 | public void AddProject(string path, string name, Guid guid, string[] files) |
51 | 51 | { |
52 | | - _projects.AppendFormat(@"Project(""{{2150E333-8FDC-42A3-9474-1A3956D46DE8}}"") = ""{0}"", ""{0}"", ""{{{1}}}""{2}", name, guid, Environment.NewLine); |
53 | | - _projects.AppendLine("\tProjectSection(SolutionItems) = preProject"); |
| 52 | + Projects.AppendFormat(@"Project(""{{2150E333-8FDC-42A3-9474-1A3956D46DE8}}"") = ""{0}"", ""{0}"", ""{{{1}}}""{2}", name, guid, Environment.NewLine); |
| 53 | + Projects.AppendLine("\tProjectSection(SolutionItems) = preProject"); |
54 | 54 | foreach (var file in files) |
55 | 55 | { |
56 | 56 | if (path == null) |
57 | 57 | { |
58 | | - _projects.AppendFormat("\t\t{0} = {0}{1}", file, Environment.NewLine); |
| 58 | + Projects.AppendFormat("\t\t{0} = {0}{1}", file, Environment.NewLine); |
59 | 59 | } |
60 | 60 | else |
61 | 61 | { |
62 | | - _projects.AppendFormat("\t\t{0}\\{1} = {0}\\{1}{2}", path, file, Environment.NewLine); |
| 62 | + Projects.AppendFormat("\t\t{0}\\{1} = {0}\\{1}{2}", path, file, Environment.NewLine); |
63 | 63 | } |
64 | 64 | } |
65 | | - _projects.AppendLine("\tEndProjectSection"); |
66 | | - _projects.AppendLine("EndProject"); |
| 65 | + Projects.AppendLine("\tEndProjectSection"); |
| 66 | + Projects.AppendLine("EndProject"); |
67 | 67 | } |
68 | 68 |
|
69 | 69 | public void AddGlobalHeader(Guid projectGuid) |
70 | 70 | { |
71 | | - _global.AppendLine ("Global"); |
72 | | - _global.AppendLine ("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution"); |
73 | | - _global.AppendLine ("\t\tDebug|Any CPU = Debug|Any CPU"); |
74 | | - _global.AppendLine ("\tEndGlobalSection"); |
75 | | - _global.AppendLine ("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution"); |
76 | | - _global.AppendFormat("\t\t{{{0}}}.Debug|Any CPU.ActiveCfg = Debug|Any CPU{1}", projectGuid, Environment.NewLine); |
77 | | - _global.AppendLine ("\tEndGlobalSection"); |
78 | | - _global.AppendLine ("\tGlobalSection(SolutionProperties) = preSolution"); |
79 | | - _global.AppendLine ("\t\tHideSolutionNode = FALSE"); |
80 | | - _global.AppendLine ("\tEndGlobalSection"); |
| 71 | + Global.AppendLine("Global"); |
| 72 | + Global.AppendLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution"); |
| 73 | + Global.AppendLine("\t\tDebug|Any CPU = Debug|Any CPU"); |
| 74 | + Global.AppendLine("\tEndGlobalSection"); |
| 75 | + Global.AppendLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution"); |
| 76 | + Global.AppendFormat("\t\t{{{0}}}.Debug|Any CPU.ActiveCfg = Debug|Any CPU{1}", projectGuid, Environment.NewLine); |
| 77 | + Global.AppendLine("\tEndGlobalSection"); |
| 78 | + Global.AppendLine("\tGlobalSection(SolutionProperties) = preSolution"); |
| 79 | + Global.AppendLine("\t\tHideSolutionNode = FALSE"); |
| 80 | + Global.AppendLine("\tEndGlobalSection"); |
81 | 81 | } |
82 | 82 |
|
83 | 83 | public void AddGlobalNestedProjects(IList<ProjectItem> nestedItems) |
84 | 84 | { |
85 | 85 | if (nestedItems.Any()) |
86 | 86 | { |
87 | | - _global.AppendLine("\tGlobalSection(NestedProjects) = preSolution"); |
| 87 | + Global.AppendLine("\tGlobalSection(NestedProjects) = preSolution"); |
88 | 88 | foreach (var item in nestedItems) |
89 | 89 | { |
90 | | - _global.AppendFormat("\t\t{{{0}}} = {{{1}}}{2}", item.Project, item.Parent, Environment.NewLine); |
| 90 | + Global.AppendFormat("\t\t{{{0}}} = {{{1}}}{2}", item.Project, item.Parent, Environment.NewLine); |
91 | 91 | } |
92 | | - _global.AppendLine("\tEndGlobalSection"); |
| 92 | + Global.AppendLine("\tEndGlobalSection"); |
93 | 93 | } |
94 | 94 | } |
95 | 95 |
|
96 | 96 | public void AddGlobal(Guid projectGuid, IList<ProjectItem> nestedItems) |
97 | 97 | { |
98 | 98 | AddGlobalHeader(projectGuid); |
99 | 99 | AddGlobalNestedProjects(nestedItems); |
100 | | - _global.AppendLine("EndGlobal"); |
| 100 | + Global.AppendLine("EndGlobal"); |
101 | 101 | } |
102 | 102 |
|
103 | 103 | public override string ToString() |
104 | 104 | { |
105 | 105 | var solutionBuilder = new StringBuilder(); |
106 | | - solutionBuilder.Append(_header); |
107 | | - solutionBuilder.Append(_projects); |
108 | | - solutionBuilder.Append(_global); |
| 106 | + solutionBuilder.Append(Header); |
| 107 | + solutionBuilder.Append(Projects); |
| 108 | + solutionBuilder.Append(Global); |
109 | 109 | return solutionBuilder.ToString(); |
110 | 110 | } |
111 | 111 | } |
|