Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / March 2006

Tip: Looking for answers? Try searching our database.

how to use CompileAssemblyFromSource to generate windows gui exe

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sotto - 08 Mar 2006 19:40 GMT
I'm trying to compile some source from within in my c# 2.0 application.

all works fine, but it always generates a windows console executable instead
of a windows gui app.
When i take a look with ildasm at the generated exe it says
.subsystem 0x0003 // WINDOWS_CUI
but i want it to be
.subsystem 0x0002 // WINDOWS_GUI

how can i tell the csharpcodeprovider to build a gui app?
Kunnis - 14 Mar 2006 07:06 GMT
I read your post and was kind of curious, so I decided to see what I could
learn.

I hit up the .Net Reflector, and looked at where the CompilerParameters were
converted to the command line args in
Microsoft.CSharp.CSharpCodeGenerator.CmdArgsFromParameters  It appears that
it looks at the CommandParameter's GenerateExecutable, and either does /t:exe
or /t:library   It doesn't appear there's a way to make it do /t:winexe,
which is what you are looking for.

I dislike any of the solutions I come up with; hopefully others will have a
better solution.  The only thought I can come up with is to do something
highly ugly like reflect the whole Microsoft.CSharp namespace and change that
line....  ICK!  Look up .Net Reflector by lutz roeder and File Dissassember
attachment for it, if you get that desperate, it may be the lesser of two
evils of writing it all from scratch.

CSharpCodeGenerator, etc. are all internal classes, so you can't inherit
from them, the other option would be to use reflection to call the internal
methods, but none of options sound really good.

Perhaps there's some way you can re-open the assembly, disassemble it, then
resave it with that flag changed.

> I'm trying to compile some source from within in my c# 2.0 application.
>
[quoted text clipped - 6 lines]
>
> how can i tell the csharpcodeprovider to build a gui app?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.