Solved

Missing reference to System.Data.Linq

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

830 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