This code (in a containing class which is re-instantiated for the second
compile) results in a generated executable that is stuck "in use" (can't be
removed etc) until the process itself terminates. I've tried several detours,
none of which help. Any suggestions, or is it a FW bug?
public bool CompileFile (string filename, string Executable)
{
VBCodeProvider codeProvider = new VBCodeProvider();
ICodeCompiler icc = codeProvider.CreateCompiler();
string Output = Executable;
System.CodeDom.Compiler.CompilerParameters parameters = new
CompilerParameters();
parameters.ReferencedAssemblies.Add ("System.dll");
parameters.ReferencedAssemblies.Add ("System.Web.dll");
parameters.ReferencedAssemblies.Add ("System.Management.Dll");
parameters.ReferencedAssemblies.Add ("System.Windows.Forms.Dll");
parameters.ReferencedAssemblies.Add ("Microsoft.VisualBasic.Dll");
parameters.GenerateInMemory = false;
//Make sure we generate an EXE, not a DLL
parameters.GenerateExecutable = true;
parameters.OutputAssembly = Output;
CompilerResults results = icc.CompileAssemblyFromFile (parameters, filename);
codeProvider.Dispose();
.....
}

Signature
Phil Wilson [MVP Windows Installer]
----
Matt Gertz - 04 Dec 2003 18:31 GMT
Phil,
Thanks for the notification on this. I'm going to do some investigation
on this today & try debugging through the problem, and I'll get back to you
either this afternoon or tomorrow morning. (My response will be posted in
languages\vb, since this is likely to be a VB issue -- I'll drop a copy of
this post over there.)
Thanks,
--Matt Gertz--*
VB Compiler Dev Lead
--------------------
>This code (in a containing class which is re-instantiated for the second
>compile) results in a generated executable that is stuck "in use" (can't be
[quoted text clipped - 21 lines]
>.....
>}
Alexandre Moura - 05 Dec 2003 01:41 GMT
I'm doing some investigation on behalf of Matt - I've been trying to repro
this, but having some problems - if I just attempt to compile a file twice,
it seems to be able to do it - also removing or altering the generated .exe
between two compilations in the same process seems to work fine - are you
actually running the generated .exe and attempting to recompile before it
terminates executing?
--------------------
>Reply-To: "Phil Wilson" <phil.wilson@unisys.spamcom>
>From: "Phil Wilson" <phil.wilson@unisys.spamcom>
[quoted text clipped - 9 lines]
>NNTP-Posting-Host: 192.59.186.207
>Path:
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGXA06.phx.gbl!TK2MSFTNGXA0
5.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
>Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.clr:8789
>X-Tomcat-NG: microsoft.public.dotnet.framework.clr
[quoted text clipped - 24 lines]
>.....
>}
Matt Gertz - 05 Dec 2003 16:43 GMT
Sorry, this should have gone to the VB newsgroup -- bit of confusion on our
side. I'll add this over there.
--------------------
>X-Tomcat-ID: 53859294
>References: <uCdYXQ4sDHA.2340@TK2MSFTNGP12.phx.gbl>
[quoted text clipped - 66 lines]
>>.....
>>}