Solved

Missing reference to System.Data.Linq

Posted on 2014-01-21
4
1,952 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
  • 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now