sqlmetal.exe 返回使用通用类型“System.Data.Linq.Table”;需要 1 个类型参数
我正在使用 sqlmetal.exr 为我生成映射代码。我通过使用调用 sql Metal。
cd C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin
SqlMetal.exe /server:servername\SQL /database:mydb /code:mycode.cs
输出是一个 cs 文件,命令 promt 表示:
Microsoft (R) 数据库映射生成器 2008 版本 1.00.30729 Microsoft (R) .NET Framework 版本 3.5 版权所有 (C) Microsoft 公司。保留所有权利。
当我将文件添加到我的项目并尝试构建它时,出现以下错误:
使用泛型类型“System.Data.Linq.Table”需要 1 种类型 论据
这是我的 mycode.cs 文件中。我引用的是 System.Data.Linq 和 System.Data。缺少什么参考资料才能使其发挥作用?
更新
确保 GAC 中有 System.Data.Linq 并且程序集 版本是3.5.0.0。还要确保这是您的项目的版本 参考。
仔细检查应用程序的目标框架是否存在某种问题 已更改为 3.5 以外的版本。 Linq To SQL 功能 仅适用于 3.5 框架。
I am using sqlmetal.exr to generate the mapping code for me. I am calling sql metal by using.
cd C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin
SqlMetal.exe /server:servername\SQL /database:mydb /code:mycode.cs
The output is a cs file and the command promt says:
Microsoft (R) Database Mapping Generator 2008 version 1.00.30729 for
Microsoft (R) .NET Framework version 3.5 Copyright (C) Microsoft
Corporation. All rights reserved.
When I add the file to my project and try to build it I get the following error:
Using the generic type 'System.Data.Linq.Table' requires 1 type
arguments
This is in my mycode.cs file. I am referencing System.Data.Linq and System.Data. What referennce is missing to get this to work?
Update
Make sure you have System.Data.Linq in your GAC and that the assembly
version is 3.5.0.0. Also make sure that's the version your project is
referencing.
Double-check that your application's target framework hasn't somehow
been changed to something other than 3.5. The Linq To SQL features
only work with the 3.5 framework.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果问题仍然存在,这里列出了您可以尝试解决问题的
一些事项需要检查/尝试的一些事项:
确保您的 GAC 中有 System.Data.Linq 并且程序集版本为 3.5.0.0。另请确保这是您的项目引用的版本。
当你查看项目参考时,是否有一个黄色的“!”参考文献旁边的图标?如果是这样,则表明 VS 未找到您的项目引用的 System.Data.Linq 版本。您应该尝试删除引用并添加新引用。
仔细检查您的应用程序的目标框架是否未以某种方式更改为 3.5 以外的版本。 Linq To SQL 功能仅适用于 3.5 框架。
if the problem persist here are a list of things you can try to resolve the issue
A few things to check/try:
Make sure you have System.Data.Linq in your GAC and that the assembly version is 3.5.0.0. Also make sure that's the version your project is referencing.
When you look at the project references is there a yellow "!" icon next to the reference? If so, that indicates that the version of System.Data.Linq your project references is not being found by VS. You should try deleting the reference and adding a new one.
Double-check that your application's target framework hasn't somehow been changed to something other than 3.5. The Linq To SQL features only work with the 3.5 framework.