简体   繁体   中英

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

"Reference assemblies for framework NETFramework,Version v2.0" were not found ...

错误

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:

x86

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

x64

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.

.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. I believe VS2010 was the last version to officially support .NET 2.0 development. .NET Framework builds rely on msbuild (so does dotnet build but with different switches and files).

Visual Studio 2017 Support for .NET Development states that VS2017 supports:

  • .NET Framework versions 4.7, 4.6.2, 4.6.1, 4.6, 4.5.2, and 3.5
  • .NET Core 2.0, 1.1, and 1.0.
  • .NET Native
  • Mono

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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