Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you add an existing form to a new project?

I have never been able to successfully add a Form from an existing file to a new project.

I read on a blog that you add just the *.cs file and the dependencies come in. Well, I tried this and the file did dragin and associate the *.designer and *.resx files. But, the Form icon does not display. Instead, the file looks like a normal *.cs file image. And, when I double click the file I get the code behind instead of the form object.

Is it possible to add existing Forms and get them properly recognized?

like image 289
P.Brian.Mackey Avatar asked Apr 25 '12 13:04

P.Brian.Mackey


1 Answers

Here's an approach that doesn't involve closing the project and reopening it:

  1. Add the 3 existing form files (cs, Designer.cs and resx).
  2. Now, exclude the 3 files you just added from the project.
  3. Open the Add existing item explorer window and go to your project directory.
  4. Select the cs file and Add.
  5. Tada. all good
like image 194
brenth Avatar answered Oct 08 '22 10:10

brenth