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

Viewed 15450

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.

12 Answers

I have just had this happen with two of my students using Visual Studio 2015 and C#. The students created a project and named it Joe's Automotive. The apostrophe in Joe's caused the issue.

The solution is to right click on the project, choose properties Under Application: Remove the apostrophe in the Assembly name

Example: Original Assembly name: Joe's Automotive Fixed Assembly name: Joes Automotive

Save and rebuild the project and it should run.

This error occurs when the assembly name matches a DLL name in the same folder. For example:

  • Test.exe
  • Test.dll

The application will fail to launch within Visual Studio due to the Test.dll in the same folder. Changing your projects Assembly Name will resolve the problem.

Delete bin and obj folders and re-run.

Related