1

I'm getting this error:

To prevent possible data loss before loading the designer, the following errors must be resolved: Could not find type 'System.Windows.Forms.Form'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built using settings for your current platform or Any CPU.

I searched for this, but did not find correct answer. Please, can anyone help?

Nino
  • 6,931
  • 2
  • 27
  • 42
Pediredla
  • 19
  • 1
  • 7
  • check in your Solution explorer, under project's references if you have `System.Windows.Forms`. If not, add it (right click on References -> Add Reference... ) – Nino Feb 24 '17 at 10:07

2 Answers2

0

This can be caused for a multitude of reasons, a common one being that components being referenced on the design surface are not available - perhaps because they are custom components and have not been compiled yet or because project references have been removed.

A good way to track down the problem (assuming that you are using Visual Studio) is to close all form design windows and then locate and open the MyForm.Desginer.cs file in the solution explorer window.

Then you need to look at the code and see where it thinks the errors are, and work out the missing types.

If the missing types are user controls then it is a good idea to put them into a separate assembly so that you can build that before you try and build the assembly with the form in it (i.e. you have the controls in one assembly and the forms in another).

Hope this helps.

SpaceUser7448
  • 189
  • 1
  • 10
  • i did.but no result. application working fine. only design is not loading at form1.cs[design]. to do something. – Pediredla Feb 24 '17 at 10:20
  • You may need to update your question to put more detail into it then. Also when I said open the MyForm.Designer.cs file - I mean find that file in the Solution Explorer and open it - it should appear as a C# program not as a design surface. Right click on it and choose 'View Code' – SpaceUser7448 Feb 24 '17 at 10:27
  • i did this by including and excluding some folders. thank you – Pediredla Feb 27 '17 at 07:00
0

You have a Design time error. What you can do, to find where the error is, is debug by attaching another instance of Visual Studio. Check this article in MSDN or this one.

Community
  • 1
  • 1
wnvko
  • 1,985
  • 1
  • 14
  • 18