此C#代码用于运行我合并在一起的Winform应用程序。我想从该C#代码创建一个exe文件。如何从我创建的文件(.cs文件)创建一个exe文件?
这怎么办?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
public class Form1 : Form
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
public Form1()
{
InitializeComponent();
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Text = "Form1";
}
#endregion
}
}
您是否尝试过使用C#编译器('csc.exe')? –
我假设你没有视觉工作室?从微软获得Visual C#Express 2010。免费! – user957902
抱歉...但我知道你对我说什么...所以我知道IDE像VS或任何东西,以及如何使用它! 我想我的C#winform生成一个exe文件!好?! ...其实...我想从我的项目(Windows窗体应用程序)生成exe文件! ...我创建一个像Visual Studio程序可以创建exe文件...但比VS更简单! 我想要一些代码来生成我的文件,我写在我的第一篇文章中的exe文件! –