@@ -11,12 +11,13 @@ namespace ScriptCs.Hosting
1111 public class VisualStudioSolutionWriter : IVisualStudioSolutionWriter
1212 {
1313 internal DirectoryInfo _root ;
14+ private Guid _nullGuid = new Guid ( ) ;
1415
15- public string WriteSolution ( IFileSystem fs , string script , IVisualStudioSolution solution , IList < Tuple < string , string > > nestedItems = null )
16+ public string WriteSolution ( IFileSystem fs , string script , IVisualStudioSolution solution , IList < ProjectItem > nestedItems = null )
1617 {
1718 if ( nestedItems == null )
1819 {
19- nestedItems = new List < Tuple < string , string > > ( ) ;
20+ nestedItems = new List < ProjectItem > ( ) ;
2021 }
2122
2223 var launcher = Path . Combine ( fs . TempPath , "launcher-" + Guid . NewGuid ( ) . ToString ( ) + ".sln" ) ;
@@ -30,26 +31,26 @@ public string WriteSolution(IFileSystem fs, string script, IVisualStudioSolution
3031 var scriptcsPath = Path . Combine ( fs . HostBin , "scriptcs.exe" ) ;
3132 var scriptcsArgs = string . Format ( "{0} -debug -loglevel info" , script ) ;
3233 _root = new DirectoryInfo { Name = "Solution Items" , FullPath = currentDir } ;
33- var projectGuid = Guid . NewGuid ( ) . ToString ( ) . ToUpper ( ) ;
34+ var projectGuid = Guid . NewGuid ( ) ;
3435
3536 solution . AddScriptcsProject ( scriptcsPath , currentDir , scriptcsArgs , false , projectGuid ) ;
3637 GetDirectoryInfo ( fs , currentDir , _root ) ;
37- AddDirectoryProject ( solution , fs , _root , null , nestedItems ) ;
38+ AddDirectoryProject ( solution , fs , _root , _nullGuid , nestedItems ) ;
3839 solution . AddGlobal ( projectGuid , nestedItems ) ;
3940 fs . WriteToFile ( launcher , solution . ToString ( ) ) ;
4041 return launcher ;
4142 }
4243
43- private void AddDirectoryProject ( IVisualStudioSolution solution , IFileSystem fs , DirectoryInfo currentDirectory , string parent , IList < Tuple < string , string > > nestedItems )
44+ private void AddDirectoryProject ( IVisualStudioSolution solution , IFileSystem fs , DirectoryInfo currentDirectory , Guid parent , IList < ProjectItem > nestedItems )
4445 {
4546 solution . AddProject ( currentDirectory . FullPath , currentDirectory . Name , currentDirectory . Guid , currentDirectory . Files . ToArray ( ) ) ;
4647 foreach ( DirectoryInfo dir in currentDirectory . Directories . Values )
4748 {
4849 AddDirectoryProject ( solution , fs , dir , currentDirectory . Guid , nestedItems ) ;
4950 }
50- if ( parent != null )
51+ if ( parent != _nullGuid )
5152 {
52- nestedItems . Add ( new Tuple < string , string > ( currentDirectory . Guid , parent ) ) ;
53+ nestedItems . Add ( new ProjectItem ( currentDirectory . Guid , parent ) ) ;
5354 }
5455 }
5556
0 commit comments