Solved

Missing reference to System.Data.Linq

Posted on 2014-01-21
4
2,005 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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

777 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