NET 框架的 C# 编译器、SDK 和 msbuild [英] C# compiler, SDK and msbuild for NET framework

查看:50
本文介绍了NET 框架的 C# 编译器、SDK 和 msbuild的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用以下方法构建 C# 代码时:

When trying to build a C# code with:

 "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" project.sln
 "C:\Program Files (x86)\MSBuild\14.0\Bin\amd64\MSBuild.exe" project.sln

我明白了:

C:\Program Files (x86)\MSBuild\14.0\bin\amd64\Microsoft.Common.CurrentVersion.targets(1098,5):错误 MSB3644:框架.NETFramework,Version=v4"的参考程序集.5"没有找到.要解决此问题,请为此框架版本安装 SDK 或 Targeting Pack,或者将您的应用程序重新定位到安装了 SDK 或 Targeting Pack 的框架版本.请注意,程序集将从全局程序集缓存 (GAC) 中解析,并将用于代替引用程序集.因此,您的程序集可能没有正确针对您想要的框架.

C:\Program Files (x86)\MSBuild\14.0\bin\amd64\Microsoft.Common.CurrentVersion.targets(1098,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.

然后我安装了来自 https://dotnet.microsoft.com/download/dotnet-framework/thank-you/net48-developer-pack-offline-installer(".NET Framework 4.8 Developer Pack")但结果是一样的.

Then I installed ndp48-devpack-enu.exe coming from https://dotnet.microsoft.com/download/dotnet-framework/thank-you/net48-developer-pack-offline-installer (".NET Framework 4.8 Developer Pack") but the result is the same.

注意:

  • 安装.NET Framework 4.8 Developer Pack"好像没有安装自己的msbuild和csc.exe.这是正常的还是我错过了什么?这就是为什么我使用之前安装 Microsoft Visual C++ Build Tools 时安装的 C:\Program Files (x86)\MSBuild\14.0\Bin\amd64\MSBuild.exe.

我只想安装从命令行构建 C# 项目的最低要求,我不想安装 Visual Studio IDE 等.

I'd like to install only the minimum to build C# projects from command-line, I don't want to install Vistual Studio IDE, etc.

推荐答案

您应该安装 .Net SDK 4.5

新版本不支持旧目标

这篇关于NET 框架的 C# 编译器、SDK 和 msbuild的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆