Link to home
Start Free TrialLog in
Avatar of TeknikDev
TeknikDevFlag for United States of America

asked on

create method to create exe based on another method

Hello, im trying to figure out how to create an exe file based on the click of a button in windows form for windows 8 in C#.net.

The exe file will basically call a method that already exists in the main.cs file and NOT to create a exe of the entire project. Can someone provide sample code? Any help would be greatly appreciated. Thanks
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Erm - are you asking how to code a compiler ?
Avatar of TeknikDev

ASKER

A compiler for JUST the function call based on the click of a button.

For instance, there's a button on the main program, when triggered will generate a separate .exe file based on a specific method created in C#.
A compiler is still a compiler AND a lot of work.
A compiler is still a compiler AND a lot of work.
Which is why you should use the one that is already written  ; )

You can dynamically compile, but I'm not sure it's going to be as simple as you hope it to be. Take a look at this example I wrote a while back and see if it is along the lines of what you are trying to accomplish.

https://www.experts-exchange.com/questions/26805504/How-to-write-and-run-a-simple-C-program-without-Visual-Studio.html?anchorAnswerId=34848988#a34848988
I didnt realize it was that much work involved in trying to create a .exe file for a function call inside a program. Hmmmm!
You might want to rephrase/rethink your question.
Maybe starting the exe with a command line parameter is what you require.
ASKER CERTIFIED SOLUTION
Avatar of sarabande
sarabande
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial