0
votes

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?

2
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

2 Answers

0
votes

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.

0
votes

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.