此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文件! –