将一个表单导出/构建为可执行文件 [英] Export/Build one Form as Executable

查看:86
本文介绍了将一个表单导出/构建为可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!我真的想找到一种方法,如何在VB.NET中的一个可执行文件中构建或导出Visual Studio中的单个表单



这样的事情:在表单一中我有一个按钮,当我按下它时,第二个表格在路径C:\中可执行。



我想为一个幼儿园创建一个游戏,但是我现在真的找不到解决方案。

Hello guys! I really want to find a way of how to build or export one single form from Visual Studio in one executable file in VB.NET

Something like this: In form one I have a button, when I press it the second form goes as executable in the path "C:\"

I want to crate a game for one kindergarten, but I really don't find a solution at this point.

推荐答案

这并不困难,但它会很狡猾。

First创建应用程序的模板作为文件 - 创建基本表单项目,并将所有program.cs和form.cd,form.designer.cs文件合并到一个名为template.cs的文件中。



然后您的应用程序可以将其用作您要生成的应用程序的基础。将修改后的文件写为MyApp.cs并尝试命令行:

It's not difficult, but it's going to be fiddly.
First create a "template" of the application as a file - create a basic forms project, and combine all the program.cs, and form.cd, form.designer.cs files into a single file called template.cs

Then your application can use that as a base for the application you want to produce. Write the modified file as "MyApp.cs" and try the command line:
%FrameworkDir%\v4.0.30319\csc.exe MyApp.cs

通过Process.Start(你可能需要更改PC上可用的框架的版本细节)。



这应该产生一个exe:MyApp .exe。



但是不要尝试在根目录中执行此操作!出于安全原因限制访问此限制并生成exe文件不太可能成功。创建一个打开权限文件夹并在那里完成。

via Process.Start (you may need to change the version detail for the Framework available on the PC).

This should produce an exe: MyApp.exe.

But do not try to do this in the root directory! Access to this is restricted for security reasons and producing an exe file there is very unlikely to succeed. Create an "open permission" folder and do it all there.


这篇关于将一个表单导出/构建为可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆