Can MS .NET 4.6 be used with Visual Studio 2010

泪湿孤枕 提交于 2020-01-03 08:28:10

问题


We are still using VS 2010 SP1 to develop a large scale LOB ASP.NET web application. The infrastructure folks are looking at pushing .NET 4.6 (and the targeting pack to devs) to the desktop and I am having trouble finding anything on compatibility with VS 2010. One of the leads here said the two are incompatible and cannot be used together and that you must have VS 2012 or higher but I can't find anything official on the topic. Anyone know if it is possible to use .NET 4.6 and VS 2010 SP1 for development?


回答1:


Visual Studio 2010 does not support the 4.6 targeting pack. When the targeting pack is pushed to the machine, Visual Studio 2010 will not see it.

Now, this isn't actually a problem if you want to remain on a supported version of .NET (which is probably why your infrastructure folks are doing what they are doing), because even if you target 4.0, you can remain supported by deploying 4.6 and running your 4.0 application on it. We shim 4.0 behavior in this case, so when you're testing on a machine with just 4.0, you can be guaranteed that the application will run with high confidence on 4.6.

However, what I see devs run into a lot, is when they target 4.0, but test on a machine with 4.6 installed, then expect to be able to deploy to 4.0 and have this just run. In this case, there's not a 100% guarantee that this will work as we do not shim every single bug fix and/or feature. This means you can accidentally pick up 4.6 behavior, and rely on it.

To summarize:

  • If you target 4.0, test on 4.0 and deploy to 4.0/4.6 -> We guarantee that this works with pretty high confidence.

  • If you target 4.0, test on 4.6 and deploy to 4.6 -> We guarantee that this works with pretty high confidence.

  • If you target 4.0, test on 4.6 and deploy to 4.0 -> This will work in most cases, but you could accidentally depend on "fixed behaviors" that aren't fixed on 4.0.




回答2:


Visual Studio does support multi-targeting. For example, if I were using Visual Studio 2012 I could install the 4.6 multi-targeting pack to develop a 4.6 application.

However, the download instructions for the 4.6 multi-targeting pack do not mention support for Visual Studio 2010, just 2012 and 2013:

The .NET Framework 4.6 Targeting Pack is a package that enables developers to build applications targeting the .NET Framework 4.6 by using either Visual Studio 2013, Visual Studio 2012 or third-party IDEs

That's as close to any documentation as I've found. This leads me to believe that no, support for 4.6 multi-targeting does not exist for Visual Studio 2010.




回答3:


Wiki contains a cross reference of visual studios and .net versions they support. MS Visual Studio History

Each new version of .NET comes with more than just a new compiler. New Tools, Projects, and even IDE functionalities are added too. If you must use the features of 4.6, you should look into upgrading your VS too.



来源:https://stackoverflow.com/questions/33378902/can-ms-net-4-6-be-used-with-visual-studio-2010

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!