views:

247

answers:

2

After installing vs 2008 sp1 , linq to sql designer is not generating the code, an error message Could not load type ' r' from assembly 'System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

+5  A: 

This often happens if you have a partial class for the data-context (etc), and have a using statement before the namespace. Freaky, I know.

so if you have (in your partial class):

using Foo;
namespace Bar {
    //...
}

Try rearranging:

namespace Bar {
    using Foo;
    //...
}

I have no idea why, but this often fixes it. Note you might need to restart VS as well to get it working again, and maybe even go into the dbml designer.

Marc Gravell
Visual Studio wiped my designer file for reasons only it knows, and I couldn't figure out why it wouldn't recreate it when I saved the dbml layout. This was in SP1. Your answer solved my problem(1 hour after messing about with csproj files though) so thanks, +1
Chris S
A: 

Its fixed, the problem was when Installing vs 2008 sp1, it haven't installed .net 3.5 sp1 automatically , i have manually installed .net 3.5 sp1 , its now working!

Priyan R