简体   繁体   English

"多目标 .NET Framework 4 和 Visual Studio 2012"

[英]Multi-targeting .NET Framework 4 and Visual Studio 2012

I have installed Visual Studio 2012 Professional on my machine.我已经在我的机器上安装了 Visual Studio 2012 Professional。 I don't have Visual Studio 2010 installed, but I want to keep developing my applications using .NET Framework 4, but I don't have this option on my Visual Studio 2012. Look at the image:我没有安装 Visual Studio 2010,但我想继续使用 .NET Framework 4 开发我的应用程序,但我的 Visual Studio 2012 上没有此选项。查看图像:

在此处输入图像描述

I don't know what can I do to fix this problem, because I click on "More Frameworks..." link and try to install the Multi-Targeting for .NET 4.0.3 (installed on my machine), but it does not work.我不知道我能做些什么来解决这个问题,因为我单击“更多框架...”链接并尝试安装 .NET 4.0.3 的多目标(安装在我的机器上),但它确实不行。 It says that this version of framework is still installed.它说仍然安装了这个版本的框架。 What can I do to fix this problem?我能做些什么来解决这个问题?

Obs: I have lots of projects in C# and VB.NET with .NET 4.0, and I need to keep these projects with new projects on .NET 4.0. Obs:我有很多使用 .NET 4.0 的 C# 和 VB.NET 项目,我需要将这些项目保留在 .NET 4.0 上的新项目中。

I solved the problem doing these tasks: 我解决了执行这些任务的问题:

  • Uninstall the Visual Studio 2012 卸载Visual Studio 2012
  • Uninstall any reference for the .NET Framework 4.0 or 4.5 卸载.NET Framework 4.0或4.5的任何参考
  • Clean the register with a tool like Glary Utilities and restart the computer 使用Glary Utilities等工具清理寄存器并重新启动计算机
  • Install the .NET Framework 4.0 and install Microsoft Multi-Targeting for .NET Framework 4. 安装.NET Framework 4.0并安装Microsoft Multi-Targeting for .NET Framework 4。
  • Install Visual Studio 2012 again 再次安装Visual Studio 2012

You fixed your problem, but it's likely that .NET Framework 4 Targeting Pack (not to be confused with the .NET Framework itself) failed to install for some reason. 您修复了问题,但.NET Framework 4 Targeting Pack(不要与.NET Framework本身混淆)可能由于某种原因而无法安装。 Did you get a warning at the end of the Visual Studio installation? 您是否在Visual Studio安装结束时收到警告? Either way, in the future, a repair install of Visual Studio 2012 should have fixed the problem (Add or Remove Programs -> Microsoft Visual Studio [Edition] 2012 -> Change -> Repair). 无论哪种方式,在未来,Visual Studio 2012的修复安装应该已经解决了问题(添加或删除程序 - > Microsoft Visual Studio [版本] 2012 - >更改 - >修复)。

I think that your issue is probably some mishap with the installation of .NET Framework. 我认为你的问题可能是安装.NET Framework的一些不幸。 I installed Visual Studio 2012 Beta and have all kind of troubles with compatibility between framework versions. 我安装了Visual Studio 2012 Beta,并且在框架版本之间存在各种问题。 The only remedy was reinstalling Visual Studio, including .NET Framework. 唯一的补救措施是重新安装Visual Studio,包括.NET Framework。

Check out How to: Target a Version of the .NET Framework (MSDN). 请查看如何:定位.NET Framework版本 (MSDN)。

创建新项目后,转到其属性(在解决方案资源管理器中选择项目,然后右键单击并选择属性)并选择目标框架!

I'm having a similar problem with Visual Studio 2021 on Windows 10.我在 Windows 10 上遇到了与 Visual Studio 2021 类似的问题。

I cloned a repository that has some .NET 4.0 projects, and Visual Studio gave me a dialog box recommending I update the target to .NET Framework 4.8 (not an option for me) but also offering to open a browser link to download the .NET Framework 4.0 targeting pack.我克隆了一个包含一些 .NET 4.0 项目的存储库,Visual Studio 给了我一个对话框,建议我将目标更新到 .NET Framework 4.8(对我来说不是一个选项),但还提供打开浏览器链接以下载 .NET Framework 4.0 目标包。

The targeting pack doesn't exist at the above mentioned link or in the Visual Studio Installer.上述链接或 Visual Studio 安装程序中不存在目标包。 There is only a 4.0 runtime, but if I try to install this Windows just says this or a newer version is already installed.只有一个 4.0 运行时,但如果我尝试安装这个 Windows 只是说这个或者已经安装了更新的版本。

I'll try uninstalling / reinstalling as described by Felipe Oriani above.我将尝试按照上面 Felipe Oriani 的描述卸载/重新安装。

There is also a solution described at the link below involving an XML file.下面的链接中还描述了一个涉及 XML 文件的解决方案。 https://superuser.com/questions/494553/net-framework-4-0-targeting-pack-does-not-show-in-visual-studio https://superuser.com/questions/494553/net-framework-4-0-targeting-pack-does-not-show-in-visual-studio

But since this issue is quite a few years old, if anyone has any new information it would be good to hear.但由于这个问题已经存在好几年了,如果有人有任何新信息,很高兴听到。

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

相关问题 使用Visual Studio和.NET Framework进行多目标构建 - Multi-targeting build with Visual Studio and .NET Framework 多目标`net461`和`netcoreapp2.0` - Multi-targeting `net461` and `netcoreapp2.0` 多目标 .net 核心 2.2 与 .net 4.6.1 - Multi-targeting .net core 2.2 with .net 4.6.1 多目标.NET程序集在.NET 4.5和.NET 4上使用async / await - Multi-targeting .NET assembly to use async/await on .NET 4.5 and .NET 4 多目标NuGet程序包的错误依赖关系解决 - Erroneous dependency resolving for multi-targeting NuGet package 在Visual Studio 2012中调试.NET Framework源代码? - Debug .NET Framework Source Code in Visual Studio 2012? .net框架版本对于仅针对Visual Studio 2010的加载项应该是什么? - What should .net framework version be for an addin targeting only Visual Studio 2010? 如何通过统一针对 Visual Studio 中错误的 .NET 框架来消除此错误警告 - How do I get rid of this error warning with unity targeting the wrong .NET framework in Visual Studio 将Visual Studio 2012 ASP.NET(4.5框架)项目部署到Server 2012 R2 Standard - Deploy Visual Studio 2012 ASP.NET (4.5 Framework) project to Server 2012 R2 Standard Visual Studio 2012多项目设置 - Visual Studio 2012 multi-project settings
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM