Visual Studio – Build – Error “NETSDK1045: The current .NET SDK does not support targeting .NET Standard 2.1. Either target .NET Standard 2.0 or lower, or use a version of the .NET SDK that supports .NET Standard 2.1.”

Background

Trying to build .Net Application, but running into an error.

Error

Error Image

error.01.20200128.0709AM - brushed.PNG

Error Text

>build
Executing Clean
Removing bin,obj directories
Executing Build
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
C:\Program Files\dotnet\sdk\2.1.507\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(150,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Standard 2.1.  Either target .NET Standard 2.0 or lower, or use a version of the .NET SDK that supports .NET Standard 2.1. [C:\downloads\tool\client\developer\tool2\20200128.0501PM\extract\technology-master\src\app\app.csproj]
C:\Program Files\dotnet\sdk\2.1.507\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(150,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Standard 2.1.  Either target .NET Standard 2.0 or lower, or use a version of the .NET SDK that supports .NET Standard 2.1. [C:\downloads\tool\client\developer\tool2\20200128.0501PM\extract\technology-master\src\Extensions\SerilogAdapter\SerilogAdapter.csproj]
C:\Program Files\dotnet\sdk\2.1.507\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(150,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Standard 2.1.  Either target .NET Standard 2.0 or lower, or use a version of the .NET SDK that supports .NET Standard 2.1. [C:\downloads\tool\client\developer\tool2\20200128.0501PM\extract\technology-master\src\Extensions\MicrosoftLoggingAdapter\MicrosoftLoggingAdapter.csproj]
C:\Program Files\dotnet\sdk\2.1.507\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(150,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Standard 2.1.  Either target .NET Standard 2.0 or lower, or use a version of the .NET SDK that supports .NET Standard 2.1. [C:\downloads\tool\client\developer\tool2\20200128.0501PM\extract\technology-master\src\developer.Caching.technology\technology.csproj]
C:\Program Files\dotnet\sdk\2.1.507\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0.  Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.0. [C:\downloads\tool\client\developer\tool2\20200128.0501PM\extract\technology-master\tests\technologyTests\technologyTests.csproj]
C:\Program Files\dotnet\sdk\2.1.507\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0.  Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.0. [C:\downloads\tool\client\developer\tool2\20200128.0501PM\extract\technology-master\tests\SerilogAdapterTests\SerilogAdapterTests.csproj]
C:\Program Files\dotnet\sdk\2.1.507\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(150,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Standard 2.1.  Either target .NET Standard 2.0 or lower, or use a version of the .NET SDK that supports .NET Standard 2.1. [C:\downloads\tool\client\developer\tool2\20200128.0501PM\extract\technology-master\src\Extensions\NLogAdapter\NLogAdapter.csproj]
C:\Program Files\dotnet\sdk\2.1.507\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0.  Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.0. [C:\downloads\tool\client\developer\tool2\20200128.0501PM\extract\technology-master\src\Extensions\AspNetCore\AspNetCore.csproj]
C:\Program Files\dotnet\sdk\2.1.507\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0.  Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.0. [C:\downloads\tool\client\developer\tool2\20200128.0501PM\extract\technology-master\tests\MicrosoftLoggingAdapterTests\MicrosoftLoggingAdapterTests.csproj]
C:\Program Files\dotnet\sdk\2.1.507\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0.  Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.0. [C:\downloads\tool\client\developer\tool2\20200128.0501PM\extract\technology-master\tests\NLogAdapterTests\NLogAdapterTests.csproj]

Build FAILED.

C:\Program Files\dotnet\sdk\2.1.507\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(150,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Standard 2.1.  Either target .NET Standard 2.0 or lower, or use a version of the .NET SDK that supports .NET Standard 2.1. [C:\downloads\tool\client\developer\tool2\20200128.0501PM\extract\technology-master\src\app\app.csproj]
C:\Program Files\dotnet\sdk\2.1.507\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(150,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Standard 2.1.  Either target .NET Standard 2.0 or lower, or use a version of the .NET SDK that supports .NET Standard 2.1. [C:\downloads\tool\client\developer\tool2\20200128.0501PM\extract\technology-master\src\Extensions\SerilogAdapter\SerilogAdapter.csproj]
C:\Program Files\dotnet\sdk\2.1.507\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(150,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Standard 2.1.  Either target .NET Standard 2.0 or lower, or use a version of the .NET SDK that supports .NET Standard 2.1. [C:\downloads\tool\client\developer\tool2\20200128.0501PM\extract\technology-master\src\Extensions\MicrosoftLoggingAdapter\MicrosoftLoggingAdapter.csproj]
C:\Program Files\dotnet\sdk\2.1.507\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(150,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Standard 2.1.  Either target .NET Standard 2.0 or lower, or use a version of the .NET SDK that supports .NET Standard 2.1. [C:\downloads\tool\client\developer\tool2\20200128.0501PM\extract\technology-master\src\developer.Caching.technology\technology.csproj]
C:\Program Files\dotnet\sdk\2.1.507\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0.  Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.0. [C:\downloads\tool\client\developer\tool2\20200128.0501PM\extract\technology-master\tests\technologyTests\technologyTests.csproj]
C:\Program Files\dotnet\sdk\2.1.507\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0.  Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.0. [C:\downloads\tool\client\developer\tool2\20200128.0501PM\extract\technology-master\tests\SerilogAdapterTests\SerilogAdapterTests.csproj]
C:\Program Files\dotnet\sdk\2.1.507\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(150,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Standard 2.1.  Either target .NET Standard 2.0 or lower, or use a version of the .NET SDK that supports .NET Standard 2.1. [C:\downloads\tool\client\developer\tool2\20200128.0501PM\extract\technology-master\src\Extensions\NLogAdapter\NLogAdapter.csproj]
C:\Program Files\dotnet\sdk\2.1.507\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0.  Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.0. [C:\downloads\tool\client\developer\tool2\20200128.0501PM\extract\technology-master\src\Extensions\AspNetCore\AspNetCore.csproj]
C:\Program Files\dotnet\sdk\2.1.507\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0.  Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.0. [C:\downloads\tool\client\developer\tool2\20200128.0501PM\extract\technology-master\tests\MicrosoftLoggingAdapterTests\MicrosoftLoggingAdapterTests.csproj]
C:\Program Files\dotnet\sdk\2.1.507\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0.  Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.0. [C:\downloads\tool\client\developer\tool2\20200128.0501PM\extract\technology-master\tests\NLogAdapterTests\NLogAdapterTests.csproj]
    0 Warning(s)
    10 Error(s)

TroubleShooting

Outline

  1. Project File
    • Review .csproj file
  2. DotNet Installation Version
    • dotnet application
      • dotnet –info
      • dotnet –list-runtimes
      • dotnet –list-sdks

Tasks

Project File

.csproj file

Source Code
Image

project.MicrosoftLoggingAdapter.csproj.01.20200128.0928AM.PNG

Text

netstandard2.1

Explanation
  1. Target Framework
    • netstandard2.1

dotnet.exe

dotnet.exe — info

Syntax

dotnet --info

Example

dotnet --info

Output
Output – Image

dotnet.info.01.20200128.0627AM.PNG

Output – Text
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

>dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.1.507
Commit: e8520940d7

Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.507\

Host (useful for support):
Version: 2.1.11
Commit: d6a5616240

.NET Core SDKs installed:
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.500 [C:\Program Files\dotnet\sdk]
2.1.507 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

Explanation
  1. The following Microsoft .Net SDKs are installed
    • Host
      • v2
        • 2.1.507
    •  Installed
      • v2
        • 2.1.202 [C:\Program Files\dotnet\sdk]
        • 2.1.500 [C:\Program Files\dotnet\sdk]
        • 2.1.507 [C:\Program Files\dotnet\sdk]

dotnet.exe — Installed SDKS

Syntax

dotnet --list-runtimes

Example

dotnet --list-runtimes

Output
Output – Image

dotnet.listruntimes.01.20200128.0958AM.PNG

Output – Text

;gt<span id="mce_SELREST_start" style="overflow:hidden;line-height:0;"></span>dotnet --list-runtimes
Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]<span id="mce_SELREST_start" style="overflow:hidden;line-height:0;"></span>
Explanation
  1. The following Microsoft .Net runtimes are installed
    • v2
      • Microsoft.AspNetCore.All
        • Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
        • Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
    • Microsoft.NETCore.App
      • Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      • Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    • Microsoft.AspNetCore.App
      • Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
      • Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]

dotnet.exe — Installed SDKS

Syntax

dotnet --list-sdks

Example

dotnet --list-sdks

Output
Output – Image

dotnet.listsdk.01.20200128.0654AM.PNG

Output – Text

2.1.202 [C:\Program Files\dotnet\sdk]
2.1.500 [C:\Program Files\dotnet\sdk]
2.1.507 [C:\Program Files\dotnet\sdk]

Explanation
  1. The following Microsoft .Net SDKs are installed
    • v2
      • 2.1.202 [C:\Program Files\dotnet\sdk]
      • 2.1.500 [C:\Program Files\dotnet\sdk]
      • 2.1.507 [C:\Program Files\dotnet\sdk]

Remediation

Outline

  1. Microsoft.Net SDK
    • Download & Install Microsoft.Net
      • Microsoft .Net Core SDK 3.x.y.z
        • Bitness
          • x32
          • x64
  2. Restart machine

Tasks

Microsoft.Net SDK

Artifacts
Overview

As of today, 2020-January-20th, the latest version is 3.1.

It was released on 2020-January-14th.

Here is the link

Image

package_01_20200128_1043AM.PNG

Included Runtimes
  1. .NET Core Runtime 3.1.1
  2. ASP.NET Core Runtime 3.1.1
  3. Desktop Runtime 3.1.1

 

Bitness

For Microsoft Windows, both 32 and 64 bit versions are available.

Download

Downloaded both 32 and 64 bit installers.

Install
Components
  1. .Net Core SDK 3.1.101
  2. .Net Core Runtime 3.1.1
  3. ASP.Net Core Runtime 3.1.1
  4. .Net Core Windows Desktop Runtime 3.1.1
Installer – x32

Image -01

microsoft.net.3.1_x32_01_20200128_0840AM.PNG

Image -02

microsoft.net.3.1_x32_02_20200128_0841AM.PNG

Image -03

microsoft.net.3.1_x32_03_20200128_0841AM.PNG

Installer – x64

Image -01

microsoft.net.3.1_x64_01_20200128_0842AM.PNG

Image -02

microsoft.net.3.1_x64_02_20200128_0843AM.PNG

Image -03

Reboot will be required.

microsoft.net.3.1_x64_03_20200128_0844AM.PNG

Image -04

microsoft.net.3.1_x64_04_20200128_0845AM.PNG

Image -05

microsoft.net.3.1_x64_05_20200128_0846AM.PNG

Restart machine

As some files are in use and locked while the .Net Frameworks are installed, please restart your machine.

 

References

  1. Ikechi Michael
    • Error NETSDK1045: .NET Standard 2.1, .NET Core 3.0
      Link
  2. dotnet
    • cli
      • debolaA
        • The current .NET SDK does not support targeting .NET Core 2.1. Either target .NET Core 2.0 or lower, or use a version of the .NET SDK that supports .NET Core 2.1. #8743
          Link
  3. ryadel
    • The Current .NET SDK does not support targeting .NET Core 3.0 – Fix How to work around a common .NET Core compilation targeting error using .NET Core 3 SDK and .NET Core 3 projects with Visual Studio
      Link

 

Truth

Truth be told, I could not find the source of the error message.

And, so dedicating to the sources referenced above.

Addendum

  1. 2020-February-2nd

One thought on “Visual Studio – Build – Error “NETSDK1045: The current .NET SDK does not support targeting .NET Standard 2.1. Either target .NET Standard 2.0 or lower, or use a version of the .NET SDK that supports .NET Standard 2.1.”

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s