错误:两个输出文件名解析为相同的输出路径:“obj\Debug\Project1.Form1.resources" [英] Error : Two output file names resolved to the same output path: "obj\Debug\Project1.Form1.resources"

查看:59
本文介绍了错误:两个输出文件名解析为相同的输出路径:“obj\Debug\Project1.Form1.resources"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到错误:

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

尝试运行我创建的 Windows 窗体应用程序时出现此错误.一些搜索显示这是由于出现了两个 .resx 文件.我的应用程序中有两个 .resx 文件.我的申请中有两种表格.我通过复制第一个表单并重命名和修改副本来创建第二个表单.两个 .resx 文件是 form1.resx 和 form2.resx.如何消除此错误?

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?

推荐答案

虽然我不知道您为什么要这样做,但您可以使用这些说明正确复制表单.不推荐.最好继承或使用用户控件.但如果你必须:

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. 删除第二个表单.
  2. 通过实际创建表单重新创建它
  3. InitializeComponent 方法从 form1.designer 复制到新表单中
  4. 同时复制InitializeComponent下面的部分.
  5. form1的代码复制到新的表单中,一定要修复构造函数
  6. 请不要使用复制粘贴复制完整的表单
  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

编辑

当有人按下更改页面按钮时,您可以:

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.

这篇关于错误:两个输出文件名解析为相同的输出路径:“obj\Debug\Project1.Form1.resources"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆