简体   繁体   English

类型“ System.Data.Linq.Binary”在未引用的程序集中定义

[英]Type 'System.Data.Linq.Binary' is defined in an assembly that is not referenced

This seems like it should be a simple solution, but I don't seem to be getting anywhere with it. 这似乎应该是一个简单的解决方案,但我似乎对此一无所知。 I am using Linq to SQL, and in my main application I have defined a class called EventArgs that holds links to three tables among other things. 我使用的是Linq to SQL,在主应用程序中,我定义了一个名为EventArgs的类,该类除其他外还包含指向三个表的链接。

I am using this class from a plugin that references the main project. 我正在从引用主项目的插件中使用此类。 It has worked fine up until now, but when I added the third table, I started getting this error. 到目前为止,它的工作情况还不错,但是当我添加第三个表时,我开始收到此错误。 The code is below: 代码如下:

results.BinaryTable.file = File.ReadAllBytes(Path);
results.BinaryTable.lprocessed = !isInvalid;
results.BinaryTable.type = "CAD_V";

The problem is with the first line (Which references a VarBinary(MAX)). 问题出在第一行(引用了VarBinary(MAX))。 If I comment it out, everything works properly. 如果我将其注释掉,则一切正常。 However, when trying to assign it a value, I get the error, "The type 'System.Data.Linq.Binary' is defined in an assembly that is not referenced. I tried adding a reference, but System.Data does not have a Linq library, and just adding System.Data does not solve the problem. 但是,当尝试为其分配值时,出现错误,“类型'System.Data.Linq.Binary'在未引用的程序集中定义。我尝试添加引用,但System.Data没有Linq库,仅添加System.Data不能解决问题。

I have since changed the 'file' type to image and reloaded the DataContext, but the Type in properties is still binary, and I still get the same error. 此后,我已将“文件”类型更改为图像并重新加载了DataContext,但是属性中的“类型”仍然是二进制的,并且仍然出现相同的错误。 I know I need to make a reference, but I'm not sure where I get that reference. 我知道我需要提供参考,但是我不确定从哪里获得参考。 Any help would be greatly appreciated. 任何帮助将不胜感激。

System.Data.Linq.Binary is in the dll System.Data.Linq.dll (not System.Data.dll) System.Data.Linq.Binary位于dll System.Data.Linq.dll(不是System.Data.dll)中

Make sure you have a reference to the assembly 确保您有对程序集的引用

See: 看到:

http://msdn.microsoft.com/en-us/library/system.data.linq.binary.aspx http://msdn.microsoft.com/en-us/library/system.data.linq.binary.aspx

它应该在程序集“ System.Data.Linq.dll”中

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

相关问题 LINQ,聚合操作不支持“System.Data.Linq.Binary”类型 - The type 'System.Data.Linq.Binary' is not supported in aggregation operations - LINQ 如何将'byte []'类型转换为'System.Data.Linq.Binary' - How to convert type 'byte[]' to 'System.Data.Linq.Binary' “System.Data.Linq.DataContext”类型在未引用的程序集中定义 - The type 'System.Data.Linq.DataContext' is defined in an assembly that is not referenced 无法将'System.Data.Linq.Binary'类型的对象强制转换为'System.Byte []' - Unable to cast object of type 'System.Data.Linq.Binary' to type 'System.Byte[]' 无法在LINQ中将类型'string'隐式转换为'System.Data.Linq.Binary - Cannot implicitly convert type 'string' to 'System.Data.Linq.Binary in LINQ to SQL 将System.Drawing.Image转换为System.Data.Linq.Binary - Converting System.Drawing.Image to System.Data.Linq.Binary .NET Core中的等效System.Data.Linq.Binary - Equivalent System.Data.Linq.Binary in .net core 在 do.net 核心中使用 System.Data.Linq.Binary? - using System.Data.Linq.Binary in dotnet core? 如何将内存流转换为System.Data.Linq.Binary? - How to convert Memory Stream to System.Data.Linq.Binary? 如何在C#中将System.Data.Linq.Binary分配为null? - How to assign System.Data.Linq.Binary to null in C#?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM