@@ -48,12 +48,16 @@ static void Write(List<string> startupProjectGuids, string solutionDirectory, st
4848 using var stream = Resource . AsStream ( $ "Solution{ resourceKey } .suotemplate") ;
4949 try
5050 {
51- using var compoundFile = new CompoundFile ( stream , CFSUpdateMode . ReadOnly , CFSConfiguration . SectorRecycle | CFSConfiguration . EraseFreeSectors ) ;
52- compoundFile . RootStorage . Delete ( "SolutionConfiguration" ) ;
53- var solutionConfiguration = compoundFile . RootStorage . AddStream ( "SolutionConfiguration" ) ;
51+ using var root = RootStorage . Open ( stream ) ;
52+ root . Delete ( "SolutionConfiguration" ) ;
53+ var solutionConfiguration = root . CreateStream ( "SolutionConfiguration" ) ;
5454
5555 SetSolutionConfigValue ( solutionConfiguration , startupProjectGuids ) ;
56- compoundFile . SaveAs ( suoFilePath ) ;
56+
57+ using var fileStream = new FileStream ( suoFilePath , FileMode . CreateNew ) ;
58+ stream . Position = 0 ;
59+ stream . CopyTo ( fileStream ) ;
60+ fileStream . Flush ( ) ;
5761 }
5862 catch ( Exception exception )
5963 {
@@ -63,7 +67,7 @@ static void Write(List<string> startupProjectGuids, string solutionDirectory, st
6367 }
6468 }
6569
66- static void SetSolutionConfigValue ( CFStream cfStream , IEnumerable < string > startupProjectGuids )
70+ static void SetSolutionConfigValue ( CfbStream cfStream , IEnumerable < string > startupProjectGuids )
6771 {
6872 var single = Encoding . GetEncodings ( )
6973 . Single ( _ => string . Equals ( _ . Name , "utf-16" , StringComparison . OrdinalIgnoreCase ) ) ;
@@ -97,6 +101,7 @@ static void SetSolutionConfigValue(CFStream cfStream, IEnumerable<string> startu
97101 }
98102
99103 var newBytes = encoding . GetBytes ( builder . ToString ( ) ) ;
100- cfStream . SetData ( newBytes ) ;
104+ cfStream . Write ( newBytes ) ;
105+ cfStream . Flush ( ) ;
101106 }
102107}
0 commit comments