.net – Missing namespaces, LINQ works in web app but not website!

.net-3.5assemblieslinqnamespaces

Okay guys, I have an asp.net website set up to target the 3.5 framework, using Linq to Sql. However, the site won't build, and i get missing namespace and assembly exception whenever i try to.

Here's the catch, I have installed 3.5 SP1, and I have added the System.Core, System.Data.Linq, System.Xml.Linq, and System.Data.DataSetExtensions assemblies to the project. What's more is, if I build the same project as a WEB APP (that compiles to a .dll), it compiles and runs just fine. What the heck is going on?

Best Solution

Alter the Web.config file and add the namespaces you want under the <pages> tag in <system.web>:

<pages>
        <namespaces>
                <add namespace="'System.Data.Linq"/>
                 // snip the rest
        </namespaces>
</pages>

Refer to this SO question.