简体   繁体   中英

LINQ Design Time Errors Upgrading From VS2010 to VS2013

After upgrading to Visual Studio 2013, I am seeing errors throughout one of my WCF Framework 4.0 projects. Wherever there is a LINQ entity query I am seeing this error upon using any LINQ function such as Any(), Single(), SingleOrDefault(), OrderBy() etc:

 Error  3   The type arguments for method
 'System.Linq.Enumerable.OrderBy<TSource,TKey>(System.Collections.Generic.IEnumerable<TSource>,
 System.Func<TSource,TKey>)' cannot be inferred from the usage. Try
 specifying the type arguments explicitly.

Example line of code generating the error:

xxxxXXXXXXStatusList = xxxXXXXXContainer.XXXXXXXStatus.OrderBy(a => a.Status).ToList();

As well as:

 Error  42  Delegate
 'System.Func<BusinessAccess.Entities.XXXPortal.XXXXXXXXInfo, int,
 bool>' does not take 1 arguments

With example:

xxxxxxInfo = xxxXXXXXContainer.XXXXXList.Where(c => c.xxxxxxid.Equals(xxxxxxid)).Single();

Here is what I have tried:

  • Building the project. It builds successfully and hides the errors temporarily until the code is edited.
  • Removing the LINQ reference and re-adding. Unsuccessful.
  • Checking that the target framework was still 4.0. It is.
  • Checked the migration log from 2010 to 2013, which showed a successful migration.
  • Upgrading to VS2013 Update 1: In progress right now...

Any ideas greatly appreciated. Clearly it's a referencing/compile configuration issue, but it's currently eluding me.

Many thanks for your time.

We found it internally. For anyone else seeing blanket problems with Intellisense, yet able to build successfully:

  • Visual Studio 2013 is not compatible with MVC3, which is what was causing all of the errors in our UI projects.
  • Also incompatibilities with Entity Framework 4 were occurring, which is what I was specifically seeing above.

I hope that this helps out someone somewhere.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM