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
TeknikDevAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
Erm - are you asking how to code a compiler ?
0
TeknikDevAuthor Commented:
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#.
0
AndyAinscowFreelance programmer / ConsultantCommented:
A compiler is still a compiler AND a lot of work.
0
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

käµfm³d 👽Commented:
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.

http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_26805504.html#a34848988
0
TeknikDevAuthor Commented:
I didnt realize it was that much work involved in trying to create a .exe file for a function call inside a program. Hmmmm!
0
AndyAinscowFreelance programmer / ConsultantCommented:
You might want to rephrase/rethink your question.
Maybe starting the exe with a command line parameter is what you require.
0
sarabandeCommented:
The exe file will basically call a method that already exists in the main.cs file


you didn't tell from arguments and didn't tell from return value.

if that is true or in case the arguments could be supplied somehow by command line options like

myexe opt=123 title="abc"

Open in new window


you could copy some kind of template code, workspace and project files, replace the foreseen template values and call the build by command line. that way is only open if the compiler and the build tools are installed on the target machine.

alternatively you could follow Andy's suggestion by providing an exe file that already has calls for each of the possible functions compiled and where you choose from the functions by passing appropriate options.

Sara
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.