简体   繁体   English

错误40:整数类型不符合名称空间或别名的条件

[英]error 40: the type integer is not qualified with a namespace or alias

Okay, this both a question and a solution. 好的,这既是一个问题,也是一个解决方案。 I was having a problem deploying a solution which very simply used linq and EF to query a couple DB2 tables and display the results to a datagridview. 我在部署一个解决方案时遇到了问题,该解决方案非常简单地使用linq和EF来查询几个DB2表并将结果显示到datagridview。 It worked fine on the development machine, but on the two other machines I tried, I would get "error 40: the type integer is not qualified with a namespace or alias." 它在开发机器上工作正常,但是在我尝试的另外两台机器上,我会收到“错误40:整数类型不符合名称空间或别名的条件”。

After two days of trying various solutions, I decided to try debugging on one of the other machines. 在尝试各种解决方案两天后,我决定尝试在另一台计算机上进行调试。

Development machine is Windows XP with Visual Studio 2010. Deployment machines both Windows 7 with VS 2010. 开发机器是带有Visual Studio 2010的Windows XP。部署机器是带有VS 2010的Windows 7。

Well, I immediately noticed that on the deployment machine, VS would give me a list of errors (integer not qualified etc.) which weren't showing on my development machine. 好吧,我立即注意到,在部署机器上,VS会给我列出我的开发机器上未显示的错误列表(整数不合格等)。 The next thing I noticed was that when I double-clicked the .edmx file in the solution, it opened in xml instead of the visual display of the tables which I was using. 我注意到的第二件事是,当我双击解决方案中的.edmx文件时,该文件以xml打开,而不是我正在使用的表的可视显示。

In this xml, every property/table column with a type of "integer" was underlined. 在此xml中,每个带有“整数”类型的属性/表列都带有下划线。 Well, that doesn't make sense. 好吧,那没有道理。 Could this VS2010 not recognize the data type which was automatically generated by the other VS2010? 这个VS2010不能识别其他VS2010自动生成的数据类型吗? Just out of desperation, I changed every instance of "Type='integer'" to "Type='int'" It debugged and ran on all 3 machines like a charm. 出于绝望,我将“ Type ='integer'”的每个实例都更改为“ Type ='int'”。它像在超级计算机上一样在所有3台机器上调试并运行。

So, my questions are: 1) Is this a bug that exists between the two development environments (XP vs. W7) or do I have my development environment set up incorrectly? 因此,我的问题是:1)这是两个开发环境(XP与W7)之间存在的错误,还是我的开发环境设置不正确? 2) On my XP machine, how can I edit my .edmx file in the xml view? 2)在XP机器上,如何在xml视图中编辑.edmx文件? Is it possible from within VS, or must I use a text editor? 是否可以从VS内进行,还是必须使用文本编辑器?

Is there an include file for your edmx which defines the "integer" type on your development machine (or a difference in framework version)? 是否为您的edmx提供了一个包含文件,该文件定义了开发计算机上的“整数”类型(或框架版本的差异)? It works when you switch to int as it is a primitive type and does not need to be defined. 当您切换到int时,它可以工作,因为它是原始类型,不需要定义。 I've only done code first so this is not a strength for me, but I think your error message is giving you a good hint. 我只是先完成代码,所以这对我来说不是优势,但是我认为您的错误消息为您提供了很好的提示。 There is no definition of the object integer in the edmx (or include files) on the other two environments. 在其他两个环境中,edmx(或包含文件)中没有对象整数的定义。 On your dev machine I think this must either exist as: 在您的开发机器上,我认为这必须以下列形式存在:

  1. A definition of an integer object somewhere in the edmx/include files edmx / include文件中某处的整数对象的定义
  2. An alias of integer to int somewhere in these same files 这些文件中某处的整数别名int
  3. A different version of .NET of EF which recognizes integer out of the box? EF的.NET的其他版本可以直接识别整数吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 “类型或命名空间定义,预期文件结尾”错误 - “Type or Namespace definition, End of File expected” Error 使用此类型的外部库后出现错误“该类型在命名空间中不存在” - Error “Type does not exist in the namespace” after using of external library in this type 错误:从字符串“”到类型“ Integer”的转换无效 - Error: Conversion from string “” to type 'Integer' is not valid Visual Studio Designer中的别名和名称空间冲突 - Alias and namespace conflict in Visual Studio Designer Windows.Storage错误:名称空间存储中不存在名称空间存储类型 - Windows.Storage error: the type of namespace Storage does not exist in namespace windows 错误:命名空间中不存在类型或命名空间名称“Interface”(是否缺少程序集引用) - Error: The type or namespace name 'Interface' does not exist in the namespace (are you missing an assembly reference) 无法解决“找不到类型或命名空间名称‘mshtml’”错误 - Can't resolve "The type or namespace name 'mshtml' could not be found" error 错误 CS0246:找不到类型或命名空间名称“CsvHelper” - error CS0246: The type or namespace name 'CsvHelper' could not be found 错误CS0246:找不到类型或名称空间名称'WebDriverWait'? - Error CS0246: The type or namespace name 'WebDriverWait' could not be found? 我收到错误消息:“添加WebService时,“类型或名称空间名称'namespace2'在名称空间'namespace1'中不存在” - I Got Error :“the type or namespace name 'namespace2' does not exist int the namespaces 'namespace1' ” when i add a WebService
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM