Nima Dilmaghani’s Technology Blog

Getting Linq to Work in Orcas Beta1 Web Site

Posted in Uncategorized by nimad on June 29, 2007

When creating an ASP.NET website, you can create a ‘Web Application Project’ or a ‘Web Site’. In Orcas Beta 1, if you chose the ‘Web Application Project’ option, and add the required references to your project (System.Core, and System.Data.Linq), you are ready to go and your project works great. However if you chose ‘Web Site’ and add the same references, you will get a bunch of compiler errors. If you compare the web.config files of these two, you will see that the ‘Web Site’ is missing the following:

<system.codedom>
<
compilers>
<
compiler language=c#;cs;csharp
extension=.cs
type=Microsoft.CSharp.CSharpCodeProvider,
System, Version=2.0.0.0,
Culture=neutral,
PublicKeyToken=b77a5c561934e089
>
<
providerOption name=CompilerVersion
value=v3.5/>
</
compiler>
</
compilers>
</
system.codedom>

Adding it right after the </system.web>
fixes the compiler errors.

Since Linq uses code generation behind the scenes, it needs to know what compiler to use and this markup defines that.  For more info you can see http://msdn2.microsoft.com/en-us/library/650ax5cx.aspx

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: