Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrading a web site from .NET 2.0 to .NET 4.0 gives warning when opening web site in Visual Studio "This project is targeting ASP.NET 2.0..."

I am using Visual Studio 2012. I have been developing on a legacy web site that uses .NET 2.0. It is configured on my local machine using IIS with an application pool set for .NET 2.0. I am able to open this web site from Visual Studio using File-Open-Web Site....no problem. This is a web site, not a compiled web application.

I just changed my application pool to .NET 4.0. My web site runs fine.

However, when I select File-Open-Web Site in Visual Studio, I get an error that says:

The site "...." is currently configured for use with a newer version of ASP.NET (4.0). This project is targeting ASP.NET 2.0; if not configured some features with the tool may not render correctly. Would you like the site to be configured for user with ASP.NET 2.0?

I can click "No" and attach to and debug the application no problem.

I have no SLN, SUO, CSPROJ, or USER files anywhere in the web site or in My Documents. I have deleted the contents of my web.config file so that it is empty. I still continue to get this message every time I open the web site.

  • Where is this message coming from?
  • Why does Visual Studio think that the web site is configured for .NET 2.0?

This is something local to my machine.

Other developers in the company have upgraded their application pool to 4.0 and do not see this message when opening the web site from Visual Studio.

like image 880
user1836602 Avatar asked Oct 06 '22 22:10

user1836602


1 Answers

While you may have upgraded your solution to be opened by Visual Studio 2012, you haven't changed the targeted .NET runtime.

To target something other then the .NET 2.0 runtime you need to change the target in the project properties.

See the following for a complete explanation.

like image 178
rie819 Avatar answered Oct 10 '22 02:10

rie819