Solved

Missing reference to System.Data.Linq

Posted on 2014-01-21
4
2,085 Views
Last Modified: 2014-01-21
I have a newly created Website project in VS 2012. It indicates the Application Type is Class Library. I have the following code in my login module:

Imports GCF2014
Imports System.Data
Imports System.Data.Linq

Partial Class Account_Login
    Inherits System.Web.UI.Page

    Dim dc As gcfDataContext = New gcfDataContext

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
.

.
.
        End If

    End Sub

I get the following error when I try to run this module:

Compiler Error Message: BC30007: Reference required to assembly 'System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' containing the base class 'System.Data.Linq.DataContext'. Add one to your project.

Source Error:


 

Line 6:      Inherits System.Web.UI.Page
Line 7:  
Line 8:      Dim dc As gcfDataContext = New gcfDataContext
Line 9:  
Line 10:     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 

I have System.Data.Linq in my list of references. I am running as ASP.Net 4.0.

Why am I getting this error?
0
Comment
Question by:steve_webber
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 19

Expert Comment

by:Rikin Shah
ID: 39796769
Hi,

Go to solution explorer -> References -> Right Click -> Add Reference -> .Net -> System.Data.Linq

Tada!!
0
 

Author Comment

by:steve_webber
ID: 39796772
I've already done that (several times, deleting the previous existin gone first).
0
 
LVL 19

Accepted Solution

by:
Rikin Shah earned 500 total points
ID: 39796785
Hi,

Let me guess...

1. Does your solution has 2 or more projects?
2. Have you tried cleaning the solution and re-add the reference?
3. Make sure you have target framework .net v4.0 or higher.

If nothing works-
Add below to your web config in assemblies section-
<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

Something like this-
<compilation debug="true">
			<assemblies>
				<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
				<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
			</assemblies>
		</compilation>

Open in new window

0
 

Author Closing Comment

by:steve_webber
ID: 39796797
Fast and accurate response.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question