@@ -95,9 +95,13 @@ internal void DeployLinqScript(Message message)
9595 string dstScriptPath = CommonFolderPaths . LinqPadQueryFolder ;
9696
9797 Log . Write ( "dstScriptPath: {0}" , dstScriptPath ) ;
98+ string targetFolder = Path . Combine ( dstScriptPath , message . AssemblyName ) ;
9899
99- string dst = Path . Combine ( dstScriptPath , string . Format ( message . FileName , message . TypeFullName ) ) ;
100- Log . Write ( "dst: {0}" , dst ) ;
100+ if ( ! Directory . Exists ( targetFolder ) )
101+ Directory . CreateDirectory ( targetFolder ) ;
102+
103+ string linqPadScriptPath = Path . Combine ( targetFolder , message . FileName ) ;
104+ Log . Write ( "linqPadScriptPath: {0}" , linqPadScriptPath ) ;
101105
102106 List < string > refAssemblies = new List < string > ( ) ;
103107 refAssemblies . AddRange ( message . ReferencedAssemblies ) ;
@@ -106,15 +110,14 @@ internal void DeployLinqScript(Message message)
106110
107111 Log . Write ( "LinqQuery file Transformed" ) ;
108112
109- using ( Stream memoryStream = FileSystem . File . Open ( dst , FileMode . Create ) )
113+ using ( Stream memoryStream = FileSystem . File . Open ( linqPadScriptPath , FileMode . Create ) )
110114 using ( StreamWriter streamWriter = new StreamWriter ( memoryStream ) )
111115 {
112116 streamWriter . Write ( linqQueryText ) ;
113117 streamWriter . Flush ( ) ;
114118 memoryStream . Flush ( ) ;
115119 }
116120 Log . Write ( "LinqQuery file Generated" ) ;
117-
118121 }
119122 catch ( Exception e )
120123 {
@@ -152,13 +155,13 @@ public Form ShowLINQPad(Stream inData, string vsVersion)
152155 DeployLinqScript ( message ) ;
153156 Log . Write ( "LinqQuery Successfully deployed" ) ;
154157
155- string linqQueryfileName = Path . Combine ( CommonFolderPaths . LinqPadQueryFolder , message . FileName ) ;
156-
158+ string linqQueryfileName = Path . Combine ( CommonFolderPaths . LinqPadQueryFolder , message . AssemblyName , message . FileName ) ;
159+ string linqPadInstallationPath = CommonRegistryConfigurations . GetLINQPadInstallationPath ( vsVersion ) ;
157160 ProcessStartInfo startInfo = new ProcessStartInfo
158161 {
159162 WindowStyle = ProcessWindowStyle . Normal ,
160163 FileName = Resources . LINQPadExe ,
161- WorkingDirectory = CommonRegistryConfigurations . LINQPadInstallationPath ,
164+ WorkingDirectory = linqPadInstallationPath ,
162165 Arguments = linqQueryfileName + " " + Resources . LINQPadCommands
163166 } ;
164167
@@ -170,8 +173,10 @@ public Form ShowLINQPad(Stream inData, string vsVersion)
170173 process . WaitForInputIdle ( - 1 ) ;
171174 process . Dispose ( ) ;
172175 }
176+ string linqPadExePath = Path . Combine ( linqPadInstallationPath , Resources . LINQPadExe ) ;
177+ string linqPadVersion = FileVersionInfo . GetVersionInfo ( linqPadExePath ) . FileDescription ;
173178
174- Process foundProcess = Process . GetProcessesByName ( "LINQPad" ) . FirstOrDefault ( p => CommonRegistryConfigurations . LINQPadVersion . Equals ( p . MainWindowTitle ) ) ;
179+ Process foundProcess = Process . GetProcessesByName ( "LINQPad" ) . FirstOrDefault ( p => linqPadVersion . Equals ( p . MainWindowTitle ) ) ;
175180
176181 SendInputToProcess ( foundProcess ?? process ) ;
177182
0 commit comments