Geeks With Blogs

News Copyright © 2008-2013 Paula DiTallo
Ask Paula! ...bringing you notes from the field...

If you're getting this message:

The type 'System.Data.Linq.DataContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. C:\Documents and Settings\pldital\My Documents\Visual Studio 2008\Projects\PatentableServices\Transform\PetabyteCompression.svc.cs 

... add...  System.Data.Linq as a reference to your project.

I still get bit every once in awhile (read: pasting together a poc) when I include a LINQ project in a solution were I've got a dependency !


 

Posted on Tuesday, June 9, 2009 5:52 PM Practical Answers , .NET | Back to top


Comments on this post: Why Can't I compile my LINQ code?

# re: Why Can't I compile my LINQ code?
Requesting Gravatar...
"You must add a reference to assembly 'System.Data.Linq" is not clear enough? ;)
Left by cguillemette on Jul 23, 2009 1:28 PM

# re: Why Can't I compile my LINQ code?
Requesting Gravatar...
Not to everyone!;-)
Left by pld on Aug 06, 2009 4:22 PM

# re: Why Can't I compile my LINQ code?
Requesting Gravatar...
Excelente : very good
Left by Alexi on Oct 04, 2010 1:36 PM

# re: Why Can't I compile my LINQ code?
Requesting Gravatar...
"You must add a reference to assembly 'System.Data.Linq" is not clear enough? ;)"

Not really, no.

If you right-click on 'References' in the project, and add a reference to System.Data.Linq, it doesn't fix the problem.

You have to add the following to Web.Config:

<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</assemblies>
</compilation>
</system.web>
</configuration>

Depending on what you're used to doing in Visual Studio, I would say that is not blindingly obvious from the error message.
Left by Mike on May 11, 2011 10:02 AM

Your comment:
 (will show your gravatar)
 


Copyright © Paula DiTallo | Powered by: GeeksWithBlogs.net | Join free