Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error : Two output file names resolved to the same output path: "obj\Debug\Project1.Form1.resources"

I'm getting the error:

Two output file names resolved to the same output path: "obj\Debug\Project1.Form1.resources"

This error comes while trying to run a windows form application I created. Some searches showed me that this occurs due to the occurrence of two .resx files. I have two .resx files in my application. Also I have two forms in my application. I created the second form by copying the first form and renaming and modifying the copy. The two .resx files are form1.resx and form2.resx. How can I remove this error?

like image 680
Foreever Avatar asked Sep 12 '13 07:09

Foreever


4 Answers

Though I don't know why will you do it, you can use these instructions to copy properly a form. It is not recommended. It is better to inherit or use user control. But if you must:

  1. Delete the second form.
  2. Recreate it by actually creating a form
  3. Copy the InitializeComponent method from form1.designer to the new form
  4. Also copy the part below InitializeComponent.
  5. Copy the code of form1 to the new form, make sure to fix the constructor
  6. Please do not copy a full form using copy paste

EDIT

When someone pushes the change page button you can do:

  private void button1_Click(object sender, EventArgs e)
  {
     Form2 frm = new Form2(NextPage);
     frm.Show();
     this.Hide();
  }

Now this is very basic syntax. you might want to have a master form that holds all the forms so you won't create over and over new forms.

The design is up to you. this example will give you basics on how to open and close forms.

like image 69
No Idea For Name Avatar answered Oct 01 '22 20:10

No Idea For Name


If you don't need the resx files you can just delete them and this problem goes away.

like image 24
Dave Cousineau Avatar answered Oct 01 '22 20:10

Dave Cousineau


This error may also occur if you use Windows10 and you have localiztion resources for CR-Cyrl-CS, CR-Latn-CS cultures. Windows10 doesn't support them any more.

like image 26
Eugene Maksimov Avatar answered Oct 01 '22 18:10

Eugene Maksimov


I encountered this problem while making a form application. When I changed the form name, the compilation problem arose due to the same error. In Visual Studio, I saw that a .resx file with 2 different names was created in the sub-tabs of the form that I changed its name in the Solution Explorer section. I deleted oldname.resx and it was fixed.

like image 36
Hamza BOZKURT Avatar answered Oct 01 '22 20:10

Hamza BOZKURT