Cakebuild script uses vs 2017 and build fails - msbuild

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?

Related

The pipeline failed on 'nuget package' restore

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.

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.

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

VS 2017 15.9.11 cannot select target framework for .net core 2.2

I have a new installation for VS 2017 with version 15.9.11, but after that I realized my ASP.NET Core projects cannot target to .NET 2.2, even thought .NET SDK 2.2.205 was installed
I tried unchecking the option 'Use previews of the .NET Core SDK' in the Options > Projects and Solutions, but it was no help.
.NET SDK 2.2.202 cannot be displayed in the target framework list of VS 2017 15.9.11, but I found a workaround with additional installation for .NET SDK 2.2.105 it should work.

How to update from Microsoft.NetCore.App 2.0 to 2.1.4

I created an ASP.NET Core Web API project in Visual Studio 2017 version 15.7.2.
When I created it, it was Microsoft.NetCore.App 2.0.
Now I want to update to Microsoft.NetCore.App 2.1.4 but I can't because Visual Studio tells me:
Implicitly referenced by an SDK. To update the package, update the
SDK to which it belongs
I download the latest version of .NET Core and I installed it, but I got the same issue.
Any ideas?
Don't confuse SDK (=> Build tools) versions with .NET Core versions.
The 2.1.* SDK versioning was unfortunate, the versioning scheme has since been changed and the scheme transition will be (mostly) complete with the release of .NET Core 2.1.
You don't need to update the Microsoft.NETCore.App NuGet package as it only contains build references needed to build your application.
For self-contained applications, you can also set the <RuntimeFrameworkVersion> property inside the csproj file, but starting with the .NET Core SDK 2.1.300, you no longer need to as it will know about the latest versions.
As Martin points out above, the SDK and .Net Core Runtime are separate entities.
I went to https://www.microsoft.com/net/download/windows and downloaded the latest SDK (2.1) and installed it on my local machine. You'll need to close any open VS instances to complete the SDK installation.
Open your project's csproj file and update netcoreapp2.0 to netcoreapp2.1 and while you're at it you can update the "Microsoft.AspNetCore.All" to version 2.1. This will save you from having to update the nuGet package.
Worked for me. Best of luck.