简体   繁体   English

将网站从.NET 2.0升级到.NET 4.0会在Visual Studio中打开网站时发出警告“此项目的目标是ASP.NET 2.0 ...”

[英]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. 我正在使用Visual Studio 2012.我一直在使用.NET 2.0的遗留网站上进行开发。 It is configured on my local machine using IIS with an application pool set for .NET 2.0. 它在我的本地计算机上使用IIS配置,并为.NET 2.0设置应用程序池。 I am able to open this web site from Visual Studio using File-Open-Web Site....no problem. 我可以使用File-Open-Web Site从Visual Studio打开这个网站....没问题。 This is a web site, not a compiled web application. 这是一个网站,而不是一个已编译的Web应用程序。

I just changed my application pool to .NET 4.0. 我刚刚将我的应用程序池更改为.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: 但是,当我在Visual Studio中选择File-Open-Web Site时,我收到一条错误消息:

The site "...." is currently configured for use with a newer version of ASP.NET (4.0). 网站“....”目前配置为与较新版本的ASP.NET(4.0)一起使用。 This project is targeting ASP.NET 2.0; 该项目针对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? 您是否希望为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. 我在网站或“我的文档”中的任何位置都没有SLN,SUO,CSPROJ或USER文件。 I have deleted the contents of my web.config file so that it is empty. 我删除了web.config文件的内容,使其为空。 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? 为什么Visual Studio认为该网站是为.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. 该公司的其他开发人员已将其应用程序池升级到4.0,并且在从Visual Studio打开Web站点时看不到此消息。

While you may have upgraded your solution to be opened by Visual Studio 2012, you haven't changed the targeted .NET runtime. 虽然您可能已将解决方案升级为Visual Studio 2012打开,但您尚未更改目标.NET运行时。

To target something other then the .NET 2.0 runtime you need to change the target in the project properties. 要定位除.NET 2.0运行时之外的其他内容,您需要更改项目属性中的目标。

See the following for a complete explanation. 有关完整说明,请参阅以下内容

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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