0

当我向现有项目添加新的时,它会显示此警告消息

'D:\Internship Project\Banking_and_Financial_System\Banking_and_Financial_System\UserLoginForm.cs' 中的类型 'Banking_and_Financial_System.UserLoginForm' 与 'D:\Internship Project\Banking_and_Financial_System\Banking_and_Financial_System\bin\Debugnancial_System.cs' 中的导入类型 'Banking_and_Financial_System.UserLoginForm' 冲突。可执行程序'。使用“D:\Internship Project\Banking_and_Financial_System\Banking_and_Financial_System\UserLoginForm.cs”中定义的类型。

在 Application.Run(new UserLoginForm()) 下一行的 Program.cs 文件中;

然后我尝试修改现有表单,将其名称更改为 Writeoff.cs 然后编译它,我得到了与上述相同的警告消息。

4

2 回答 2

2

这告诉你:

  • UserLoginForm.cs中,有一个类型叫做Banking_and_Financial_System.UserLoginForm
  • 还有一个类型Banking_and_Financial_System.UserLoginForm调用Banking_and_Financial_System.exe

这两个对我来说听起来是一回事,但似乎后者是指您的应用程序的编译版本。我觉得这有点奇怪,我不确定这里的技术细节,但这听起来像是一个意外包含导致冲突。

您真的是要引用.exe调试文件夹中的 -file 吗?如果您明确添加了此类引用,则应尝试将其删除。

更新

说明:您可以直接从已编译的 .exe 引用和访问公共类

于 2013-04-26T07:57:03.917 回答
1

这与表单的文件名和文件的名称空间无关。

您应该为此调用指定命名空间

Application.Run(new [insertcorrectnamespace].UserLoginForm());

错误告诉您的是它不知道您要使用哪个用户登录表单,因为该类知道两个具有相同名称但不同命名空间的信息

于 2013-04-26T07:48:23.587 回答