Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9077189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:16:58+00:00 2026-06-16T19:16:58+00:00

I wanna build a builder for my application this is the source of the

  • 0

I wanna build a builder for my application this is the source of the builder

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.CodeDom.Compiler;
using Microsoft.CSharp;

namespace MyAppBuilder
{

    public partial class Form1 : Form
    {
    public Form1()
    {
        InitializeComponent();
    }

    private void BuildBtn_Click(object sender, EventArgs e)
    {
        CompilerParameters Params = new CompilerParameters();
        Params.GenerateExecutable = true;

        Params.ReferencedAssemblies.Add("System.dll");
        Params.ReferencedAssemblies.Add("System.Drawing.dll");
        Params.ReferencedAssemblies.Add("System.Windows.Forms.dll");
        Params.ReferencedAssemblies.Add("System.Runtime.InteropServices.dll");
      //  Params.ReferencedAssemblies.Add("System.Diagnostics");
        Params.ReferencedAssemblies.Add("System.Threading.dll");
        Params.ReferencedAssemblies.Add("System.IO.dll");
       //Params.ReferencedAssemblies.Add("Microsoft.Win32.dll");
        Params.OutputAssembly = "output.exe";
        Params.CompilerOptions = " /target:winexe";
        string Source = Properties.Resources.LockerSource;
        CompilerResults results = new CSharpCodeProvider().CompileAssemblyFromSource(Params, Source);
        if (results.Errors.Count < 0)
        {
            MessageBox.Show("nice");
        }
        else
        {
            foreach (var error in results.Errors)
            {
                MessageBox.Show(error.ToString());
            }
        }
    }
}

}

And this is the source of the application i want to build
Don’t pay attention to the referrence assemblies added to the CsharpCodeProvider

using System;
using System.Drawing;
using System.Windows.Forms;



namespace MyApp
{
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
                #region AddControls
                //Basic Form Seetings
                this.Text = "AppName";
                this.ControlBox = false;
                this.ShowInTaskbar = false;
                //Add Contidions TextBox
                RichTextBox conditions = new RichTextBox();
                this.Controls.Add(conditions);
                conditions.Width = this.Width;
                conditions.Height = this.Height / 2;
                conditions.BackColor = this.BackColor;
                conditions.BorderStyle = BorderStyle.None;
                conditions.Text =@"Sometext";
                conditions.Font = new Font(conditions.Font.FontFamily, 8, conditions.Font.Style | FontStyle.Bold);
                conditions.Location = new Point(0, 130);
                conditions.Enabled = false;
                this.Width += 15;
                //Add Contidions TextBox
                //Add CodeTextBox
                TextBox codeBox = new TextBox();
                this.Controls.Add(codeBox);
                codeBox.Width = this.Width - 60;
                codeBox.Location = new Point(20, 10);
                codeBox.TextAlign = HorizontalAlignment.Center;
                //Add CodeTextBox
                //Add DownloadButton
                Button DownloadBtn = new Button();
                this.Controls.Add(DownloadBtn);
                DownloadBtn.Location = new Point(19, 35);
                DownloadBtn.Width = 130;
                DownloadBtn.Height = 30;
                DownloadBtn.Text = "Download Code";
                Button SubmitBtn = new Button();
                this.Controls.Add(SubmitBtn);
                SubmitBtn.Location = new Point(this.Width - 169, 35);
                SubmitBtn.Width = 130;
                SubmitBtn.Height = 30;
                SubmitBtn.Text = "Submit";
                Button VerifyEmailBtn = new Button();
                this.Controls.Add(VerifyEmailBtn);
                VerifyEmailBtn.Location = new Point(19, 70);
                VerifyEmailBtn.Width = codeBox.Width + 1;
                VerifyEmailBtn.Height = 30;
                VerifyEmailBtn.Text = "Click here if you need to verify your email";
                //Add DownloadButton
                #endregion
            }


        }
    }

But i get the following error

the type or namespace name “Form” could not be found(are you missing a
using directive or an assembly reference)

I understand the error just can’t understand what i could be missing.

I hope i get some responses as i am really stuck.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T19:16:59+00:00Added an answer on June 16, 2026 at 7:16 pm

    You need to add a suitable entrypoint for the app.

    Look at the Main() function in Program.cs that VS.NET generates as a model.

    You also need to remove the InitializeComponent() call.

    After those changes, it compiles just fine for me.

    This is the code I have (I made your program into a string for my purposes):

    using Microsoft.CSharp;
    using System;
    using System.CodeDom.Compiler;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    
    namespace formcomp
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                CompilerParameters Params = new CompilerParameters();
                Params.GenerateExecutable = true;
    
                Params.ReferencedAssemblies.Add("System.dll");
                Params.ReferencedAssemblies.Add("System.Drawing.dll");
                Params.ReferencedAssemblies.Add("System.Windows.Forms.dll");
                Params.ReferencedAssemblies.Add("System.Runtime.InteropServices.dll");
                Params.ReferencedAssemblies.Add("System.Threading.dll");
                Params.ReferencedAssemblies.Add("System.IO.dll");
                Params.OutputAssembly = "output.exe";
                Params.CompilerOptions = " /target:winexe";
                string Source = GetSource();
                CompilerResults results = new CSharpCodeProvider().CompileAssemblyFromSource(Params, Source);
                if (results.Errors.Count < 0)
                {
                    MessageBox.Show("nice");
                }
                else
                {
                    foreach (var error in results.Errors)
                    {
                        MessageBox.Show(error.ToString());
                    }
                }
            }
    
            private string GetSource()
            {
                string code = "using System; " + Environment.NewLine;
                code += "using System.Drawing;" + Environment.NewLine;
                code += "using System.Windows.Forms;" + Environment.NewLine;
                code += "namespace MyApp" + Environment.NewLine;
                code += "{" + Environment.NewLine;
                code += "public class Program" + Environment.NewLine;
                code += "{" + Environment.NewLine;
                code += "[STAThread]" + Environment.NewLine;
                code += "static void Main()" + Environment.NewLine;
                code += "{" + Environment.NewLine;
                code += "Application.EnableVisualStyles();" + Environment.NewLine;
                code += "Application.SetCompatibleTextRenderingDefault(false);" + Environment.NewLine;
                code += "Application.Run(new Form1());" + Environment.NewLine;
                code += "}" + Environment.NewLine;
                code += "}" + Environment.NewLine;
                code += "        public partial class Form1 : Form" + Environment.NewLine;
                code += "        {" + Environment.NewLine;
                code += "            public Form1()" + Environment.NewLine;
                code += "            {" + Environment.NewLine;
                code += "                #region AddControls" + Environment.NewLine;
                code += "                //Basic Form Seetings" + Environment.NewLine;
                code += "                this.Text = \"AppName\";" + Environment.NewLine;
                code += "                this.ControlBox = false;" + Environment.NewLine;
                code += "                this.ShowInTaskbar = false;" + Environment.NewLine;
                code += "                //Add Contidions TextBox" + Environment.NewLine;
                code += "                RichTextBox conditions = new RichTextBox();" + Environment.NewLine;
                code += "                this.Controls.Add(conditions);" + Environment.NewLine;
                code += "                conditions.Width = this.Width;" + Environment.NewLine;
                code += "                conditions.Height = this.Height / 2;" + Environment.NewLine;
                code += "                conditions.BackColor = this.BackColor;" + Environment.NewLine;
                code += "                conditions.BorderStyle = BorderStyle.None;" + Environment.NewLine;
                code += "                conditions.Text =\"Sometext\";" + Environment.NewLine;
                code += "                conditions.Font = new Font(conditions.Font.FontFamily, 8, conditions.Font.Style | FontStyle.Bold);" + Environment.NewLine;
                code += "                conditions.Location = new Point(0, 130);" + Environment.NewLine;
                code += "                conditions.Enabled = false;" + Environment.NewLine;
                code += "                this.Width += 15;" + Environment.NewLine;
                code += "                //Add Contidions TextBox" + Environment.NewLine;
                code += "                //Add CodeTextBox" + Environment.NewLine;
                code += "                TextBox codeBox = new TextBox();" + Environment.NewLine;
                code += "                this.Controls.Add(codeBox);" + Environment.NewLine;
                code += "                codeBox.Width = this.Width - 60;" + Environment.NewLine;
                code += "                codeBox.Location = new Point(20, 10);" + Environment.NewLine;
                code += "                codeBox.TextAlign = HorizontalAlignment.Center;" + Environment.NewLine;
                code += "                //Add CodeTextBox" + Environment.NewLine;
                code += "                //Add DownloadButton" + Environment.NewLine;
                code += "                Button DownloadBtn = new Button();" + Environment.NewLine;
                code += "                this.Controls.Add(DownloadBtn);" + Environment.NewLine;
                code += "                DownloadBtn.Location = new Point(19, 35);" + Environment.NewLine;
                code += "                DownloadBtn.Width = 130;" + Environment.NewLine;
                code += "                DownloadBtn.Height = 30;" + Environment.NewLine;
                code += "                DownloadBtn.Text = \"Download Code\";" + Environment.NewLine;
                code += "                Button SubmitBtn = new Button();" + Environment.NewLine;
                code += "                this.Controls.Add(SubmitBtn);" + Environment.NewLine;
                code += "                SubmitBtn.Location = new Point(this.Width - 169, 35);" + Environment.NewLine;
                code += "                SubmitBtn.Width = 130;" + Environment.NewLine;
                code += "                SubmitBtn.Height = 30;" + Environment.NewLine;
                code += "                SubmitBtn.Text = \"Submit\";" + Environment.NewLine;
                code += "                Button VerifyEmailBtn = new Button();" + Environment.NewLine;
                code += "                this.Controls.Add(VerifyEmailBtn);" + Environment.NewLine;
                code += "                VerifyEmailBtn.Location = new Point(19, 70);" + Environment.NewLine;
                code += "                VerifyEmailBtn.Width = codeBox.Width + 1;" + Environment.NewLine;
                code += "                VerifyEmailBtn.Height = 30;" + Environment.NewLine;
                code += "                VerifyEmailBtn.Text = \"Click here if you need to verify your email\";" + Environment.NewLine;
                code += "                //Add DownloadButton" + Environment.NewLine;
                code += "                #endregion" + Environment.NewLine;
                code += "            }" + Environment.NewLine;
                code += "        }" + Environment.NewLine;
                code += "    }" + Environment.NewLine;
                return code;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanna build my own chat client using xmpp on android to chat with
I wanna learn how to build a p2p application in python that conforms to
I wanna build a client server iphone app and for this i need to
Im trying do build a form using ajax. I read this tutorial, but it
I wanna build custom desktop notification for my desktop application. notifyicon seems to be
I am trying to build a search system and retrieving matching records. in this
I am trying to build a database for a trading system. The data is
i am getting data from XML into html using jquery, i build a function
I wanna build a gallery, but the my problem is how to load the
i've built my first wpf application, nothing fancy, but i wanna make it look

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.