Error While trying to run the project: could not load file or assembly 'Windowsformapplication1' or one of its dependencies?

15,234

Solution 1

Make sure your project's name doesn't have an apostrophe, as they can cause errors.

Solution 2

I have found three simple steps:

GO TO START ---> RUN

  1. Type prefetch and delete all files
  2. Type recent and delete all files
  3. Type %temp% and delete all files

Solution 3

Probably, one of designed component thrown unhandled exception during initialization of events. Generally it's occurs when you remove a method (1) for delegate (E.g.TexChanged, Click) but you not remove the reference(2) for this method in design source (Form1.Designer.cs).

//1.
private void txtBox_TextChanged(object sender, EventArgs e)
{

}

//2.
this.txtBox.TextChanged += new System.EventHandler(this.txtBox_TextChanged);

Solution 4

I found 4 simple steps to solve this error:

  1. Visual Studio => Run as Admin
  2. Project Properties => Build => Platform Target : Any Cpu
  3. Build => Clean
  4. Run

Solution 5

4 steps to solved a problem :

  1. open your project.

  2. from solution explorer select your project name Beside them icon" c#" and right click and select properties.

  3. click Application > startup object: (Not set) > change to (your project name) .program.

  4. run a project (F5)

Now the project is working successfully.

Share:
15,234
Saeed Khan
Author by

Saeed Khan

Updated on June 13, 2022

Comments

  • Saeed Khan
    Saeed Khan almost 2 years

    Scenario: I have windows form application, it was working fine before two days but after last two days it is giving me error:

    Error While trying to run the project: could not load file or assembly 'Windows form application 1' or one of its dependencies

    I have tried two days to find solutions but all in vain.

    Could any body please help me or suggest me some suggestions.

    • user1703401
      user1703401 over 10 years
      Where did the spaces in the name come from? The boilerplate name for a winforms app is WindowsFormsApplication1. If you rename it then do pick a name without spaces to avoid accidents. Look at the Error window to ensure that the project built correctly.
    • Sergey Kalinichenko
      Sergey Kalinichenko over 10 years
      It looks like one of the assemblies you are referencing is missing. If you've spent two days chasing this already, it may be faster to tart from scratch, and move the code into a new project, trying to see that your program remains runnable after each modification that you make.
  • Andrew Uricchio
    Andrew Uricchio over 9 years
    This worked for me. My assembly name had an apostrophe; removing it compiled the application.