VS compile problem after moving solution to 2010

I switched recently our asp.net 3.5 solution from VS 2008 to VS 2010 while still wanting it to be in .net 3.5 (as the deployment server runs on 3.5 only)

The libraries are migrated ok - no problems, but the web site is causing problems. The error message I get on every aspx page is like this:

D:\WebSites\.....aspx: ASP.NET runtime error: Could not load type 'Microsoft.Build.Framework.ITaskItem2' from assembly 'Microsoft.Build.Framework, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

I found out that the interface the compiler is looking for (ITaskItem2) is only available in .net 4.0, but it keeps looking for it in 3.5 assembly which is obviously wrong.

I was trying to locate where this discrepancy is originating, but with no luck.

It hinders my work significantly, because when the page is not compiled, the intellisense is not working for asp components, also debugging of the web pages is not working.

But even when this error occurs in VS, the pages are working correctly when displaying them in browser (using IIS), so this is VS-only problem.

If you have any idea, what could be wrong here, please let me know.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rikin ShahMicrosoft Dynamics CRM ConsultantCommented:

Check if the project is still using .net framework 3.5? Go to project properties and change the .net version to 4.0 if not and compile.
OndrejovicAuthor Commented:

thanks for proposal. I did this and it solved the mentioned error. However it produced load of new problems mostly with referenced libraries. :(

Example: Reference required to assembly 'System.Data.DataSetExtensions, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' containing the base class 'System.Data.TypedTableBase`1'. Add one to your project.

Which was not there before.

I need to keep the whole project in 3.5 as this is the latest version available on production server.
Rikin ShahMicrosoft Dynamics CRM ConsultantCommented:

If there is no key added for this in web.config, add it.

<compilation debug="true">
    <add assembly="System.Data.DataSetExtensions, Version=, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

OndrejovicAuthor Commented:

but I would rather solve this problem without switching the website to 4.0 (as 3.5 is running on prod server)
Rikin ShahMicrosoft Dynamics CRM ConsultantCommented:

Have you tried explicit loading System.Data.DataSetExtensions.dll to the project?

Try replacing: using System.Data.DataSetExtensions; with using System.Data;
OndrejovicAuthor Commented:
I solved this at last...

the thing I have done is that I removed the existing web.config from the website and let Visual Studio generate new one (default). Then I added the few options/settings we use and things started to work.

The difference in old and new web.config was just one section:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <assemblyIdentity name="Microsoft.Build.Framework"
       publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
      <bindingRedirect oldVersion="" newVersion=""/>

Open in new window

which was removed in the new web.config.

The section originally appeared when the project was switched from .net 2.0 to 3.5 and never caused us any problem until switching the development environment to Visual Studio 2010.

That's it.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
OndrejovicAuthor Commented:
I found the solution by myself..
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.