开发者

Visual Studio 2010 won't compile LINQ properly after power outage reboot

I had a rather large solution properly compiling until my power went out.

Now, I have a standard Linq to Sql DataContext class defined in one project, and it compiles properly, however another project that references that assembly refuses to compile Linq properly.

I'm getting compile errors like

'DataLayer.AdminDataContext': type used in a using statement must be implicitly convertible to 'System.IDisposable'

from a simple

using (DataLayer.AdminDataContext context = new DataLayer.AdminDataContext()) {...}

and errors like

'System.Data.Linq.Table'1<DataLayer.User>' does not contain a definition for 'Where' and no extension method 'Where' accepting a first argument of type 'System.Data.Linq.Table'1<DataLayer.User>' could be found (are you missing a using directive or an assembly reference?)

from

var users = context.Users.Where(u=>u.Username == Username);

I've cleared out every files from

Windows\Microsoft.Net\Framework\v2.0.50727\Temporary ASP.NET Files Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files

and I've attempte开发者_JS百科d 'Clean Solution' and every variant of Rebuild I can concoct, to zero success. Does anyone have any ideas why one project in a solution won't compile, while others will? The DataLayer project seems to compile Linq fine, and recognizes "using" and "Where" without an issue, while the other project won't compile.


Shot in the dark but try launching VS with the /ResetSkipPkgs switch

http://msdn.microsoft.com/en-us/library/ms241276(VS.80).aspx


"does not contain a definition for 'Where' and no extension method 'Where' accepting a first argument of type "

I've seen this error when there is a missing reference to the System.Core assembly or a missing "using System.Linq" at the top of the file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜