I've just upgraded to Visual Studio 2015 and am now getting lots of error messages when modifying any ASPX page or Web Part in a SharePoint 2010 project that uses databinding syntax within a ListView:

CS0234  The type or namespace name 'ListViewDataItem' does not exist in the namespace 'System.Web.UI.WebControls' (are you missing an assembly reference?)

That error appears twice for every <%# %> making the error list useless because it can fill up with hundreds of these messages. All the references are the same as they were when developing on VS 2010 (e.g. System.Web and System.Web.Extensions are both referenced) and there are no issues when the project is packaged and deployed. The issue persists when running VS in Safe Mode or creating a brand new SharePoint 2010 farm solution but not when working with standard web projects that target .NET 3.5.

Is there a way to fix this?

  • Usually SharePoint 2010 projects been created with VS 2010 editions with .NET framework 3.5 as the framework version.Can you try with .net 3.5 only and NOT with any other higher framework versions. – userAZLogicApps Dec 16 '15 at 14:01
  • The projects only target .NET 3.5. I have double checked it by creating a new solution with a single empty SharePoint farm project after first selecting .NET 3.5 in the new project dialog. Unfortunately the problem is still there. – user49621 Dec 16 '15 at 14:31

Have a look at this answer over at StackOverflow: https://stackoverflow.com/a/24486074/1037864

Right-click on the project and select Properties.
On the Application tab, change the Target framework version and save the project.
Repeat steps 1 and 2 to set the target framework back to the one you want.
Save the .aspx file again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.