帮助CodeDom入口点 [英] Help with the CodeDom entry point

查看:83
本文介绍了帮助CodeDom入口点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用CodeDom进行项目.生成代码工作正常,我遇到的问题是切入点.

我想启动一个表单,然后像这样设置入口点:

I''ve been working on a project using CodeDom. Generating the code is working fine, what I''m having trouble with is the entry point.

I want to start a form, and I set up the entry point like so:

Dim start As New CodeEntryPointMethod()

Dim codeexp As New CodeSnippetStatement("Dim f As New Form")
start.Statements.Add(codeexp)
codeexp = New CodeSnippetStatement("f.showdialog()")
start.Statements.Add(codeexp)

vClass.Members.Add(start)



出于某种原因,当我运行生成的应用程序时,它会创建一个控制台以及一个表单.谁能告诉我这样做的原因,以及如何关闭可见的控制台?我只想在应用程序的开头启动表单.

这可能是我想念的简单事情,但是整日拔掉头发后,我认为朝正确的方向发展可能是个好主意. :)



For some reason, when I run the generated application, it creates a console along with a form. Could anyone please tell me the reason it does this, and how I can turn off the visible console? I just want to launch the form at the start of the application.

It''s probably something simple I''m missing, but after pulling my hair out all day I thought it might be a good idea to get pointed in the right direction. :)

推荐答案

这只是编译选项之一.创建控制台只是Windows应用程序的可选步骤,而不是替代方法. C#和VB.NET编译器都有两个选项:"/target:winexe"或"/target:exe".第一个并没有真正告诉编译器任何与Windows应用程序有关的事情(怎么可能呢?没有"windows"之类的东西,没有System.Windows.Forms,WPF等等).它只是说不要创建默认控制台".第二个选项启用控制台.可能是默认情况下.

因此,一个真正的问题是Microsoft在编译选项中使用的术语不太明确.

您需要通过字符串属性System.CodeDom.Compiler.CompilerParameters. CompilerOptions使用第一个选项,请参见 http: //msdn.microsoft.com/zh-CN/library/system.codedom.compiler.compilerparameters.aspx [
This is just one of the compilation options. Creating a console is just an optional but not alternative to the Windows Application. There are two options in both C# and VB.NET compilers: "/target:winexe" or "/target:exe". The first one does not really instruct a compiler about anything related to Windows application (how could it possibly do it? there is no such thing as "windows", there are System.Windows.Forms, WPF and could be anything else). It simply says "do not create a default console". And the second option enables the console. Probably you got it by default.

So, one real problem is not quite clear terminology used by Microsoft in compilation options.

You need to use the first option using the string property System.CodeDom.Compiler.CompilerParameters. CompilerOptions, see http://msdn.microsoft.com/en-us/library/system.codedom.compiler.compilerparameters.aspx[^].

—SA


这篇关于帮助CodeDom入口点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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