创建新表单时出现警告消息

时间:2013-04-26 07:41:42

标签: c# winforms compiler-warnings

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

  

'D:\实习中的'Banking_and_Financial_System.UserLoginForm'类型   项目\ Banking_and_Financial_System \ Banking_and_Financial_System \ UserLoginForm.cs'   与导入类型冲突   'D:\实习中的'Banking_and_Financial_System.UserLoginForm'   项目\ Banking_and_Financial_System \ Banking_and_Financial_System \ BIN \调试\ Banking_and_Financial_System.exe”。   使用'D:\ Internship中定义的类型   项目\ Banking_and_Financial_System \ Banking_and_Financial_System \ UserLoginForm.cs'。

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

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

2 个答案:

答案 0 :(得分:2)

这告诉你:

  • UserLoginForm.cs中,有一种名为Banking_and_Financial_System.UserLoginForm
  • 的类型
  • Banking_and_Financial_System.UserLoginForm
  • 中还有一个类型Banking_and_Financial_System.exe

这两个对我来说听起来像是一样的东西,但似乎后者是指你的应用程序的编译版本。我发现有点奇怪,我不确定这里的技术细节,但这听起来像是偶然的包含导致冲突。

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

更新

说明:You can refer to and access public classes directly from a compiled .exe

答案 1 :(得分:1)

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

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

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

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

相关问题