@@ -77,9 +77,14 @@ static void Main(string[] args)
7777 if ( args . Length > 1 )
7878 outputfilename = args [ 1 ] ;
7979
80+ string exepath = Path . GetFullPath ( path ) + Path . DirectorySeparatorChar + "MissionPlanner.exe" ;
81+ string version = Assembly . LoadFile ( exepath ) . GetName ( ) . Version . ToString ( ) ;
82+
83+ System . Diagnostics . FileVersionInfo fvi = FileVersionInfo . GetVersionInfo ( exepath ) ;
84+
8085 sw = new StreamWriter ( file ) ;
8186
82- header ( ) ;
87+ header ( fvi . ProductVersion ) ;
8388
8489 sw . WriteLine ( " <Directory Id=\" INSTALLDIR\" Name=\" Mission Planner\" >" ) ;
8590
@@ -96,10 +101,7 @@ static void Main(string[] args)
96101
97102 sw . Close ( ) ;
98103
99- string exepath = Path . GetFullPath ( path ) + Path . DirectorySeparatorChar + "MissionPlanner.exe" ;
100- string version = Assembly . LoadFile ( exepath ) . GetName ( ) . Version . ToString ( ) ;
101-
102- System . Diagnostics . FileVersionInfo fvi = FileVersionInfo . GetVersionInfo ( exepath ) ;
104+
103105
104106 string fn = outputfilename + "-" + fvi . ProductVersion ;
105107
@@ -147,28 +149,12 @@ static void runProgram(string run)
147149 P . Start ( ) ;
148150 }
149151
150- static void header ( )
152+ static void header ( string version )
151153 {
152154 string newid = System . Guid . NewGuid ( ) . ToString ( ) ;
153155
154156 newid = "*" ;
155157
156- StreamReader sr = new StreamReader ( File . OpenRead ( "../MissionPlanner.csproj" ) ) ;
157-
158- string version = "0" ;
159-
160- while ( ! sr . EndOfStream )
161- {
162- string line = sr . ReadLine ( ) ;
163- if ( line . Contains ( "<Version>" ) )
164- {
165- string [ ] items = line . Split ( new char [ ] { ' ' , '"' , '<' , '>' } , StringSplitOptions . RemoveEmptyEntries ) ;
166- version = items [ 1 ] ;
167- break ;
168- }
169- }
170- sr . Close ( ) ;
171-
172158 string data = @"<?xml version=""1.0"" encoding=""utf-8""?>
173159<Wix xmlns=""http://schemas.microsoft.com/wix/2006/wi"" xmlns:netfx=""http://schemas.microsoft.com/wix/NetFxExtension"" xmlns:difx=""http://schemas.microsoft.com/wix/DifxAppExtension"" xmlns:iis='http://schemas.microsoft.com/wix/IIsExtension' >
174160
0 commit comments