1

So what I want to do is create an executable in a program in vb. What I mean by this is that there is a program that can output a .EXE. What I try to do is to create a program that can output a smaller program that runs predefined commands.

All I know is that it is somehow possible with a STUB. That you open the STUB and add extra code to it and save it again as an .EXE.

Tilak
  • 30,108
  • 19
  • 83
  • 131
FierceFuzion
  • 19
  • 1
  • 7

1 Answers1

3

You can use compiler services to create EXE at run time.

CSharpCodeProvider : Provides access to instances of the C# code generator and code compiler.

Dynamic Creation of Assemblies/Apps

System.CodeDom.Compiler

Tilak
  • 30,108
  • 19
  • 83
  • 131
  • So i have tried this and it kinda works, i tried to compile a simple command line script (hello world) and it tells me that "console" is not declared in "console.writeline" and is there a way i can compile a hole form ? – FierceFuzion Oct 19 '13 at 16:45
  • @FierceFuzion - Just like a project in Visual Studio, when you compile code inside your .Exe, you need to include all the necessary references for the code to work properly. For example, if you want to compile a Windows Forms program, you will need to make sure that you reference the System.Windows.Forms assembly. – Chris Dunaway Oct 21 '13 at 14:56