C# compiler, SDK and msbuild for NET framework

好久不见. 提交于 2020-06-29 05:05:15

问题


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

I get:

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.

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.

Note:

  • The installation of ".NET Framework 4.8 Developer Pack" did not seem to install its own msbuild and csc.exe. Is this normal or am I missing something? That's why I used C:\Program Files (x86)\MSBuild\14.0\Bin\amd64\MSBuild.exe that had been installed previously when installing Microsoft Visual C++ Build Tools.

  • 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.


回答1:


You should install .Net SDK 4.5

Newer version don't support older targets



来源:https://stackoverflow.com/questions/62550657/c-sharp-compiler-sdk-and-msbuild-for-net-framework

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