The pipeline failed on 'nuget package' restore - asp.net-core

I created a pipeline but when the process failed all the time on "Nuget Restore", see error message below.
I don't understand why
Thanks for your help
*The nuget command failed with exit code(1) and error(C:\Program Files\dotnet\sdk\2.2.110\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.2 or lower, or use a version of the .NET SDK that supports .NET Core 3.0. [D:\a\1\s\PackSecurity\PackSecurity.csproj] C:\Program Files\dotnet\sdk\2.2.110\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.2 or lower, or use a version of the .NET SDK that supports .NET Core 3.0. [D:\a\1\s\PackSecurity.Tests\PackSecurity.Tests.csproj])
Packages failed to restore*

Use "windows-2019" as the agent. Click on "Agent job 1" and set "Agent Specification" as "windows-2019".
Let me know if it worked for you.

According to the error message:
The current .NET SDK does not support targeting .NET Core 3.0. Either
target .NET Core 2.2 or lower, or use a version of the .NET SDK that
supports .NET Core 3.0.
We could to know that you have one or more projects target to the .NET Core 3.0, but the agent you select does not have that version .NET Core installed by default. It should has version 2.2.11 installed.
To resolve this issue, we could add a Use .NET Core task to install the .net core 3.0.x:
Check the similar ticket for some more details.
Hope this helps.

Related

Is .NET Core 3.1 backward compatible?

I want to know if .NET Core 3.1 is backward compatible with .NET Core 2.1. I am getting below error while adding a nuget package(say package X) targeting .netcoreapp2.1 to my .netcoreapp3.1 project:
NU1202: Package is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package supports: netcore21 (.NETCore,Version=v2.1)
Note that the TFM netcore21 is not .NET Core 2.1.
Because the TFM netcorexx has been taken by some former deprecated platform that used to be called ".NET Core", which is not the well known .NET Core at all.
The proper TFM for .NET Core is netcoreappx.x (to be distinguished from the deprecated platform).
Thus this is irrelative to backward compatibility problem. And the nuget package that you are trying to add does not ever target any version of .NET Core.

The current .NET SDK does not support targeting .NET Core 3.0 on TFS 2015 build

I am migrating an existing ASP.NET Core 2.2 web app to 3.0. I've updated the .csproj file and all references to support 3.0. Everything compiles on my dev machine, but when I try to build the app on the build server (TFS 2015 with the SDK / runtimes for ASP.NET Core 3.0) I get this error.
The current .NET SDK does not support targeting .NET Core 3.0. Either target .NET Core 2.2 or lower, or use a version of the .NET SDK that supports .NET Core 3.0
I have correctly referenced the ASP.NET Core framework in the .csproj
Here are my project dependencies from my Visual Studio project.
Why does MSBUILD still try to reference ASP.NET Core 2.2 when everything now references 3.0?
After further investigation the problem was I didn't have the correct version of MSBUILD on the build server. As ASP.NET Core 3.0 only runs on VS2019 you therefore need MSBUILD for VS2019. After installing this on the build server the problem has now been resolved.

Cakebuild script uses vs 2017 and build fails

I'm working on a legacy project based on Habitat home. There is a PowerShell script which I'm using since there is no cake extension for vs2019. But I'm getting those errors
Version 2.2.300 of the .NET Core SDK requires at least version 16.0.0
of MSBuild. The current available version of MSBuild is
15.8.169.51996. Change the .NET Core SDK specified in global.json to an older version that requires the MSBuild version currently
available.
and
C:\Program Files (x86)\Microsoft Visual
Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.TargetFrameworkInference.targets(112,5):
error : The current .NET SDK does not support targeting .NET Core
2.2. Either target .NET Core 1.1 or lower, or use a version of the .NET SDK that supports .NET Core 2.2.
I've changed the cake-config.json like this - "BuildToolVersions": "VS2019". But nothing cahnged.
Is there another config/xml or something that has to be changed?

Problem in Building Project in Asp.net Core 2.2

I'm facing a problem of building a project of ASP.NET core 2.2 in visual studio 2017. Please Note that I'm successfully able to build and run project in ASP.NET core 2.1 . I have installed asp.net core 2.2 . I have also found in visual studio that when I created a Project of ASP.NET core I select .NET core version 2.2 As shown in the picture .
When I build the project first time I got this error
"Severity Code Description Project File Line Suppression State
Error NETSDK1045 The current .NET SDK does not support targeting .NET Core 2.2. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 2.2. WebApplication2 C:\Program Files\dotnet\sdk\2.1.505\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets 137 "
Please note that I have installed .net core 2.2 through package manager console through nuget but still I'm getting this yellow sign suggest that dependency problem . Please see the picture in bellow .
So I could not able to build and run the project what should I do . Thanks in advance
Its seems you have installed the wrong the version of .NET Core SDK for .NET Core 2.2.4 and Visual Studio 2017. You said that you have downloaded and installed the .NET Core SDK version 2.2.203 which is actually for Visual Studio 2019! That's the problem!
For Visual Studio 2017, Its SDK 2.2.106 for .NET Core 2.2.4. Please download it from here: https://dotnet.microsoft.com/download/dotnet-core/2.2 and install.
You error should go away now!
Download the SDK 2.2 in dot net core I think you don't have the SDK downloaded for the targeted version.
https://dotnet.microsoft.com/download/dotnet-core/2.2

Error in Visual Studio CI/CD .Net Core Project

We faced lots of build errors on Visual Studio CI/CD for .net core project but this is our last error and we can't figure it out.
Our project is based on .net core v1.1 and the last error asked us to upgrade to .net core v2.0 and we did that.
All of the CI steps are succeed expect dotnet ef migrations:
This is error message:
Method 'get_Properties' does not have an implementation. in type
'Microsoft.Extensions.Configuration.ConfigurationBuilder' from
assembly 'Microsoft.Extensions.Configuration, Version=1.1.2.0,
Culture=neutral, PublicKeyToken=adb9793829ddae60'.
Note: The project is building local machine and on Visual Studio CI
It looks like you did not upgrade your solution successfully to .net core 2.x., since you're configuration is still depending on on a package from 1.1.
You should upgrade Microsoft.Extensions.Configuration to 2.0 (2.1.1, if you're on .net core 2.1)
Update-Package Microsoft.Extensions.Configuration -version 2.0.0 -reinstall
https://www.nuget.org/packages/Microsoft.Extensions.Configuration/