.NET 4.5项目未在Visual Studio中编译2022

发布于 2025-01-22 19:39:31 字数 1009 浏览 0 评论 0 原文

我今天在PC上安装了Visual Studio 2022。我有一个旧应用,该应用程序针对.NET 4.5。我在尝试构建/编译项目时会看到此错误:

“错误MSB3644找不到.netFramework的参考组件,版本= v4.5。要解决此问题,请安装此框架版本的开发人员包(SDK/Targeting Pack)或重新定位您的应用程序。 “

我已经读过: https://thomaslevesque.com/2021/11/11/12/building-a-project-project-target-target-net-45-inet-45-in-visual-studio-2022/ 。 C:\ Program Files(X86)\ Reference Assemblies \ Microsoft \ Framework.netframework \ V4.5在我的PC上已经存在。

我在此处下载了.NET 4.5开发人员包:。当我尝试运行它时,我会看到这一点:

”“在此处输入图像描述”

我还有其他尝试吗?

I have installed Visual Studio 2022 on my PC today. I have an old app, which targets .NET 4.5. I see this error when attempting to build/compile the project:

"Error MSB3644 The reference assemblies for .NETFramework,Version=v4.5 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks"

I have read this: https://thomaslevesque.com/2021/11/12/building-a-project-that-target-net-45-in-visual-studio-2022/. C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5 already exists on my PC.

I have downloaded the .NET 4.5 Developer Pack here: https://learn.microsoft.com/en-gb/dotnet/framework/install/guide-for-developers. I see this when I attempt to run it:

enter image description here

Is there anything else I can try?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

爱*していゐ 2025-01-29 19:39:31

因为您可能会首先安装更高版本的.NET框架,因此安装程序可能会阻止您安装较低版本的.NET框架,

因此另一种方法可以尝试修复它而无需重新安装。

  1. 下载 Microsoft.netframework.netframework.referenceassemblies.net45 包装文件
  2. microsoft.netframework.referenceassemblies.net45.nupkg microsoft.netframework.referenceassemblies.net45.zip 和unzip cropred
  3. crecre 文件
  4. croprecred 来自 build \ .netFramework \ V4.5 \ to c:\ program Files(x86)\ Reference Assemblies \ Microsoft \ Microsoft \ Framework \ .netFramework \ .netframework \ v4.5 运行的 您的项目再次。

注意

这种方式也适用于.net4.0 或其他哪个微软可能不支持功能

Because you might install a higher version of .net framework firstly, so installer might stop you install a lower version of .net framework

There is another way can try to fix it without reinstalling.

  1. Download Microsoft.NETFramework.ReferenceAssemblies.net45 package file
    enter image description here
  2. Modify the file extension name from microsoft.netframework.referenceassemblies.net45.nupkg to microsoft.netframework.referenceassemblies.net45.zip and Unzip that
  3. Copy the files from build\.NETFramework\v4.5\ to C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5
  4. Running your project again.

Note

This way was also work for .net4.0 Microsoft.NETFramework.ReferenceAssemblies.net40 or other older version of .net framework which Microsoft might not support in feature

望笑 2025-01-29 19:39:31

如果您想要一种不太黑的方式,另一个选择是下载VS2017构建工具,并仅安装.NET Framework 4.5 Targeting Pack(来自Tab单个组件)。这可以与Visual Studio 2022一起使用,因为它安装了需要的参考组件。

If you want a less hacky way, another option is to download the VS2017 Build Tools and install the .NET Framework 4.5 Targeting Pack only (from the tab Individual Components). This works fine with Visual Studio 2022, since it installs the reference assemblies where they are needed.

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文