.NET Core SDKs are not detected when creating an ASP.NET Core Web Application - asp.net-core

I'm having trouble with Visual Studio 2019 not finding the .NET Core SDKs.
I have installed a preview version of .NET Core 3.0 (v.9) and removed all the previous version of .NET Core SDKs.
When I am trying to create an ASP.NET Core Web Application from the template form in VS2019, I am getting the following error below:
No .NET Core SDKs were detected, ensure they are included in the environment variable 'PATH'. https://i.imgur.com/ye1rliG.png
I have checked on my environment variables and the paths to the dotnet core folders are available. https://i.imgur.com/Jz8T9eQ.png
Also, I have the Use previews of the .NET Core SDKs in the Tools->Options->Environment->Preview Features, selected.
Has anyone else got any ideas where I can take it from as I have followed Microsoft help guide on this issue but to no avail?

Related

Helper library for ASP.NET Core 5 - NuGet packages not available?

I'm writing a helper library for ASP.NET Core 5 (with .NET 5) and I need some APIs from the package Microsoft.AspNetCore.Server.Kestrel.Core. However, the package is only available in version 2.2 - not version 5.
Is ASP.NET Core no longer distributed via NuGet? And if so, how does one get the APIs with ASP.NET Core 5.
Side note: I found that I could use Microsoft.NET.Sdk.Web as SDK for the project but I'm unsure whether this is a valid/good/correct approach when writing a library.
Is ASP.NET Core no longer distributed via NuGet? And if so, how does one get the APIs with ASP.NET Core 5.
That's correct. The core of ASP.NET Core (no pun intended...) ships with .NET Core >= 3.0 as a shared framework. You can add a single FrameworkReference to your nuget package to pull this in. See https://learn.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-5.0&tabs=visual-studio#migrate-libraries-via-multi-targeting for more information.
Some background can be found here https://github.com/dotnet/aspnetcore/issues/3756

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

ASP.NET Core 3.0 not showing on Visual Studio 2019

I want to test the new Blazor server-side framework (aka Razor Components).
I installed Visual Studio 2019 RC, and then the .Net Core 3.0 preview 2, following this official tutorial.
After the install, I only see the ASP.NET Core 2.0 and the 2.1 on the "Create a new ASP.NET Core Web Application" page. The 3.0 is not showing up.
I started to mess around, trying to install other packages from this page, uninstalled and reinstalled Visual Studio 2019, updated to the .NET Core Preview 3, installed several times the x64 and x86 packages in different orders, copy/paste the .Net Core binaries to random folders and so on. Nothing works. The ASP.NET Core 3.0 does not show up.
Here is what my VS looks like when creating a project (the yellow message appeared latter after some messing around with the packages, so it is not the real problem):
Here is the output of the dotnet --list-sdks command:
EDIT
For some reason, I installed the Blazor VSIX package (the WebAssembly - not exactly what I want, but I installed it anyways) and now the ASP.NET Core 3.0 simply shows up. However, just for the blazor templates:
I don't understand. Is there anything obvious I'm missing?
There is an option in Tools -> Options that enables preview versions of the .NET Core SDK. In the VS Preview shipping channel, it is on (by default, and not settable). In the VS Release channel, it defaults to off and you can opt-in.
(Note: it's disabled in the screenshot because I have a Preview build installed.)
The reason for this is to allow you to customize whether a project using a released version of .NET Core (such as 2.1, the current LTS) will use tooling from the newer not-yet-release-quality SDK.
Prior to 16.1, this option was located on the Tools -> Options -> Projects and Solutions -> .NET Core page.
Here is what I did to show .NET Core 3.0 in VS2019
Installed .NET Core 3.0 SDK (No Success)
Restarted VS2019 after installing .NET Core 3.0 SDK (No Success)
Updated VS2019 (Worked Perfectly)
I had the same issue. Here is what worked for me.
First, download the latest .Net Core 3.0 SDK (see 1,2 below).
Next, Check for updates (4,5). (this is what helped me the most)
Next, Enable Preview SDK (5,6,7,8,9) and restart
Now, the .net core 3.0 option should show (11).
It no longer works... again!
The SDK 3.0.100-preview8-013656 doesn't provide the ASP.Net Core 3.0 project template.
You have to uninstall it and install SDK 3.0.100-preview7-012821
https://dotnet.microsoft.com/download/dotnet-core/3.0
I have the same issue here after moving from Visual Studio 2019 Preview to Visual Studio 2019 RC.
This page seems to suggest that you need Preview to use .net Core 3.0 which is annoying.
https://dotnet.microsoft.com/download/dotnet-core/3.0
I looked up the difference between RC and Preview, and they pull builds from different channels (stable and preview).
The next thing I’m going to try is to go back to Preview to see if .Net Core 3.0 becomes visible again.
Tried to get .NET Core 3 (preview 8 in my case) to work in the release version of Visual Studio 2019 but ASP.NET Core 3.0 refused to show up in the "Create new ASP.NET Core web application" dialog.
What eventually worked was to install the Preview version of Visual Studio 2019.
I could have saved a few hours and a lot of hair if I had taken the warning text ".NET Core 3.0 should be used with the latest previews of Visual Studio." (https://dotnet.microsoft.com/download/dotnet-core/3.0) more literally...
In my case is because I did not installed Visual Studio 2019 with that feature. So just create a new project and type .net core. Then click on Install more tools and features:
Then add the following feature:
I had this problem and solved it as follows:
STEP 1: Download .NET Core 3.0
STEP2: Enable the ability to consume preview SDKs by default, As shown below:
I had the very same issue. I tried everything with no success
I already had only x64 version of .NET Core SDK
In addition i had to install x86 version too. That WORKED !!!
If your solution uses global.json and sdk:version isn't compatible with the target framework, it won't let you select it or it disappears from Target framework drop-down in your project's properties. You will need to update it to something like this:
{
"sdk": {
"version": "3.1.0",
"rollForward": "latestMinor"
}
}
I resolved it by installing
dotnet-sdk-3.1.403-win-x86.exe
dotnet-sdk-3.1.403-win-x64.exe
Because the visual studio was taking the SDK from "C:\Program Files (x86)\dotnet\sdk" once you install "dotnet-sdk-3.1.403-win-x86.exe" there will one folder under the above directory. then no need to restart your PC.
https://dotnet.microsoft.com/download/visual-studio-sdks?utm_source=getdotnetsdk&utm_medium=referral
ASP.Net Core 3.0+ just runs on vs2019 version 16.7+.
You need to go to help tab on your visual studio and check for updates and update it to the latest version
Note! (don't use it on your developer machine)
0- make sure you installed .net core 3 sdk. dotnet --list-sdks
1- make sure Tools -> Options that enables preview versions of the .NET Core SDK enabled.
2- uninstall all x86 version of .net core sdk from your machine.
3- restart visual studio and try to create a new project.
I was not able to get .netcore 3.0 preview8 working on my Visual Studio Community Edition (version 16.2.3). I opted to uninstall .netcore 3.0 preview8 and I installed .netcore 3.0 preview7 instead. After insalling .netcore 3.0 preview7 In Visual Studio I checked use previews of the .NET Core SDK option that is in Tools -> Options -> Preview Features and I restarted it. That worked for me, but if someone have .netcore 3.0 preview8 already working, help will be appreciated it.
I've encountered the same problem on a Mac and found a solution to this issue.
On visual studio update tab (Visual Studio -> check for updates) there is a option to change channel to "Preview".
After that you can download necessary updates and go using .net core 3.0
I noticed an interesting behavior. I had the latest version of VS with all the dependencies installed. But when I try to add a new project to the solution, the dialog does not show me the options beyond .Net Core 2.2
But When I create the new project from the startup page, the drop down does show the ASP.NET Core 3.1
So I was able to work around the issue by creating the new project from the startup page, then add the existing project to the solution.
I've had the same issue after installing .net core 3.1. This is how I resolved it.
open powershell, type dotnet --version, it returns '2.2.300'
go to 'programs and features', unistall .net core sdk 2.2.3.0
run dotnet --version again, it returns '3.1.302' and in VS 2019 it shows '.net 3.1'
This answer is for the newest .NET Core version as of 10/11/2020, which is .NET Core 5.0
Specs: VS Version 16.8.0
Target Version of .Net Core: 5.0
You must have version 16.8.0 in order to have .Net Core 5.0
If you still have problems with Visual Studio not showing .Net Core 5.0 in Visual Studio version 16.8.0 (and assuming you downloaded the .NET Core 5.0 SDK for Visual Studio), well, apparently (and correct me if I'm wrong) it is now called just .Net 5.0, omitting the Core.
After selecting .NET 5.0, I was able to install other libraries which are currently version 5.0+ and dependent on .NET Core 5.0+
Is the new name intentional? Anyways, here some evidence of this working (I was able to install the newest version of Newtonsoft and Entity Framework for .Net Core):
Funny enough, when I try to create a new .Net Core project, the version shows up as expected:
I'm very sorry for my English!
[PS: I'm literally copying&pasting this answer, which I answered somewhere else, but given that, when you Google this issue, this stackoverflow question appears first. So thats why I'm reposting]

.NET Core is not listed

I wanted to create a new ASP.NET Core app targeting the new .NET Core 1.0.
First, in Visual Studio 2015 Update 3, I don't see .NET Core listed
And this is what I'm seeing in project.json file. Looks like I'm targeing dotnet5.6
Is it safe to assume this is all correct?
And if this is correct, could it possibly be more confusing?
The pulldown has no meaning for .NET Core projects as it doesn't use it. Only what's in project.json matters for .NET Core / .xproj projects.
netcoreapp1.0 target framework moniker (short TFM) is .NET Core project for executables (ASP.NET Web Application or .NET Core Console Application). netstandard1.x (see this matrix for api surface of netstandard TFM) is for class libraries.
The import section just tells nuget to also restore packages which target dotnet5.6 (old TFM for .NET Core Library, which is now replaced with netstandard1.x) and portable-net45-win8, which are also compatible with .NET Core. These allow you to install packages which are compatible but are not yet repackaged for netstandard1.x.