简体   繁体   English

NET 2.0项目是从VS2017构建的,而不是从命令行构建的

[英]NET 2.0 project builds from VS2017 but not from the command line

I'm trying to build FluentFTP , which has releases for .NET 2.0, 3.5, 4.0 and .NET Standard. 我正在尝试构建FluentFTP ,它具有.NET 2.0、3.5、4.0和.NET Standard的发行版。 All of the releases build fine within the VS 2017 IDE on Windows 7. However when I try to build using dotnet.exe , it crashes with this error: 所有版本在Windows 7上的VS 2017 IDE内dotnet.exe 。但是,当我尝试使用dotnet.exe进行构建时,它会因以下错误而崩溃:

"Reference assemblies for framework NETFramework,Version v2.0" were not found ... 找不到“框架NETFramework,版本v2.0的参考程序集” ...

错误

My build script looks like this: 我的构建脚本如下所示:

dotnet --info
dotnet restore -v Minimal

dotnet build -c Release

pause

How do I build this successfully from the console? 如何从控制台成功构建它?

It would appear you are missing the .NET 2.0 SDK, here are the links to install it: 似乎您缺少.NET 2.0 SDK,以下是安装它的链接:

x86 86

https://www.microsoft.com/en-us/download/details.aspx?id=19988 https://www.microsoft.com/en-us/download/details.aspx?id=19988

x64 64位

https://www.microsoft.com/en-us/download/details.aspx?id=15354 https://www.microsoft.com/en-us/download/details.aspx?id=15354

Per the docs the dotnet build command-line approach is only meant to support .NET Core builds, not .NET Framework builds. 根据文档dotnet build命令行方法仅旨在支持.NET Core构建,而不是.NET Framework构建。

.NET Framework 2.0 isn't supported by any current build system and it also isn't supported by Visual Studio 2017, so I'm surprised it worked correctly. 当前的任何构建系统均不支持.NET Framework 2.0,Visual Studio 2017也不支持.NET Framework 2.0,因此令我感到惊讶的是它可以正常工作。 I believe VS2010 was the last version to officially support .NET 2.0 development. 我相信VS2010是正式支持.NET 2.0开发的最后一个版本。 .NET Framework builds rely on msbuild (so does dotnet build but with different switches and files). .NET Framework构建依赖于msbuild( dotnet build也是如此,但具有不同的开关和文件)。

Visual Studio 2017 Support for .NET Development states that VS2017 supports: Visual Studio 2017对.NET Development的支持表明VS2017支持:

  • .NET Framework versions 4.7, 4.6.2, 4.6.1, 4.6, 4.5.2, and 3.5 .NET Framework版本4.7、4.6.2、4.6.1、4.6、4.5.2和3.5
  • .NET Core 2.0, 1.1, and 1.0. .NET Core 2.0、1.1和1.0。
  • .NET Native .NET本机
  • Mono

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM