且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从运行exe创建一个exe

更新时间:2023-01-07 22:07:47

这是可能的。此类应用程序称为编译器编译器 - *** [ ^ ])。



但写一个是高级任务(非常高难度)。
It is possible. Such applications are called compilers (Compiler - Wikipedia[^]).

But writing one is an advanced task (very high level of difficulty).


.NET框架 - 您的VB应用程序运行所需的 - 包括CSC.EXE文件,它是C#编译器,因此,每台能够运行您的应用程序的计算机都可以生成EXE文件 - 但前提是您的应用程序发出有效的C#代码,并通过C#编译器运行它。 VB编译器不包含在.NET安装中,因此从技术上讲,您需要在每台计算机上安装VS以使用VB作为目标语言。这可能会给你带来问题,部分原因在于规模,但主要是因为版权和许可条件的违反......



有两种选择:生成本机代码或者你自己的IL EXE文件 - 这是很多工作 - 或者编写一个处理脚本并为它生成脚本的应用程序。取决于你想要做什么 - 即你想要创建的应用程序的工作有多复杂 - 这可能是很多,更快,更可靠。
The .NET framework - which your VB app will need in order to run - includes the CSC.EXE file which is the C# compiler, so every computer capable of running your app can produce EXE files - but only if your app emits valid C# code, and runs it through the C# compiler. The VB compiler is not included with .NET installations, so technically you would need to install VS on each computer to use VB as your "target language". That could well give you problems, partly because of the size, but mostly the breach of copyright and licencing conditions...

There are two alternatives: produce a native code or IL EXE file yourself - this is a lot of work - or write an app that processes scripts and generate those scripts for it instead. Depending on what you are trying to do - i.e. how complex a job you want the app you create is - this could be a lot, lot quicker and more reliable.