This is an odd one, not one I've come across before. My project complies and runs fine if I have my classes in the root folder (Not in App_Code).
As soon as I move them into the App_Code folder then it will compile, but running it will bring up the old
CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
I don't understand how moving the class(es) to the App_Code folder causes the whole thing to fall apart there?
Project target is .Net 4 on VWD 2010 Express
You have to modify the web.config file of your web application to make it compile and use .net 3.5 (or maybe higher in your case):
<system.web>
<compilation>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
</compilation>
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5" />
<providerOption name="WarnAsError" value="false" />
</compiler>
</compilers>
</system.codedom>
I had the exact same problem. The answer for me was to set Local Copy to True in the Properties Window for System.Data.Linq.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With