Visual studio не видит sdk net core
Test on d15prerel.26526.3002
OS: Windows 10 X64
The text was updated successfully, but these errors were encountered:
robertmclaws commented Jul 9, 2017
So, it's great that the issue is fixed in later builds, but if I'm outside Microsoft and don't have access to newer builds, how do I fix it?
davidfowl commented Jul 9, 2017
This issue was reported on an internal build to begin with. If you're seeing the issue it might be something completely different, or it might have been a bug in the preview that you can't work around.
What exactly are you seeing?
robertmclaws commented Jul 9, 2017
mlorbetske commented Jul 9, 2017
Could you check your PATH environment variable to see if there are entries for a dotnet directory under both Program Files and Program Files (x86) please? If there are two entries, could you move the Program Files one to be before the Program Files (x86) one, restart Visual Studio and see if that helps please?
robertmclaws commented Jul 10, 2017
Hmm, there are actually NO PATH entries for dotnet anymore, even after repairing both the SDK and VS2017.3.
What are they supposed to be?
robertmclaws commented Jul 10, 2017
OK, it's supposed to be C:\Program Files\dotnet\ (as found on another machine). Adding it back to the PATH and restarting VS solved the problem.
natemcmaster commented Jul 27, 2017
aKabirKhan commented Jul 31, 2017
Any update on this, we are stuck since code analysis is only working after 2015.3 preview 2 and installing preview 6 breaks the sln with error mentioned above.
kspearrin commented Jul 31, 2017
aKabirKhan commented Jul 31, 2017 •
calebp commented Aug 10, 2017
barrytang commented Aug 11, 2017
To report new issues, use the Report a Problem tool. The GitHub Issue Tracker for the aspnet/Tooling repo is now deprecated in favor of the Report a Problem tool.
If you encounter a problem with Visual Studio, we want to know about it so that we can diagnose and fix it. By using the Report a Problem tool, you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks. See here for more details.
ghost commented Sep 6, 2017
"My path was set to Program Files (x86)\dotnet. Changing path to Program File\dotnet solved the problem." - How check my current path and change it to another one ?
sandykulk commented Sep 6, 2017
Any update on this issue. I have set the path to "c:\Program File\dotnet" but still cannot open the project.
ghost commented Sep 6, 2017 •
I figure it out.
You can check info by typing dotnet --info in CMD
brijmcq commented Sep 12, 2017 •
barrytang commented Sep 13, 2017
cbassigit commented Sep 14, 2017
brijmcq commented Sep 14, 2017
donsartain commented Sep 18, 2017
I'm having the same problem, without VS 2017 installed.
manish-jain-1 commented Sep 26, 2017
Still happening on VS2017 15.3.5 + core 2.0. tried all above solutions.
lalalaring commented Oct 11, 2017
Still happening on VS2017 15.4.0 + core 2.0. tried all above solutions.
CDuke commented Oct 14, 2017
kikomi commented Oct 18, 2017
lalalaring commented Oct 18, 2017
frank-lores commented Dec 11, 2017
Changing the PATH Environment variable from C:\Program Files(x86)\dotnet to C:\Program Files\dotnet fixed the problem.
YuriyZaletskyy commented Jan 8, 2018
Neither adding global.json, nor adding for user path: C:\Program Files\dotnet\ didn't solve the problem for me.
Alex61NN5 commented Jan 23, 2018
Still not working, none of the above solved for me
barrytang commented Jan 24, 2018
To report new issues, use the Report a Problem tool. The GitHub Issue Tracker for the aspnet/Tooling repo is now deprecated in favor of the Report a Problem tool.
If you encounter a problem with Visual Studio, we want to know about it so that we can diagnose and fix it. By using the Report a Problem tool, you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks. See here for more details.
MarcosRZ commented Oct 6, 2019 •
This is NOT a new Issue.
Note the 2.1.802 SDK version below.
Could you PLEASE explain us how to solve this old issue? In my case, upgrading the SDK version is not an option.
Looking in the .csproj file, they are all targeting
Additionally, I have ensured that the path to the SDK 'C:\Program Files\dotnet' is included in my PATH variable. I tried adding a global.json file specifying the sdk, but it didn't seem to make a difference.
Any idea what could be causing this issue?
Edit
Below is an example of the csproj file
, and here is the folder with all the SDKs on my machine.
when I do dotnet --list-sdks, it does include the 3.0 sdk (3.0.100 [C:\Program Files\dotnet\sdk]). Additionally I have opened and closed it several times with the same result
9 Answers 9
I have same issue and I found the solution; I hope you have the same issue as I do.
cmd -> input dotnet --info
copy .Net Core's "Base Path"
Just add it to your system's Path variable.
The variable name is MSBuildSdksPath
Some possible causes:
- you need to restart the computer, because the environment variables are cached
- you need to restart Visual Studio, because Visual Studio caches, too (close all instances of it)
- you have installed the 64-Bit version of the SDK, but you need the 32-Bit SDK, or vice-versa.
- you have installed an old preview sdk, and need to enable preview versions in the options of Visual Studio (or download the non-preview SDK since it's RTM)
You could try one trick I learned:
Open a command line prompt, and type env
get the path environment variable
Now replace C:\Program Files\dotnet\; with D:\Programs\LessPortableApps\dotnet\ , where D:\Programs\LessPortableApps\dotnet\ is the folder where you put your dotnet-sdks in.
Then, set the path environment variable SET PATH="bla" to your new path, with the dotnet folders replaced.
And then start Visual Studio from the command prompt, e.g. :
Now when I try to run the project it says version 2.1 was not found.
Finally, I have below SDKs installed in my machine.
Now while opening the solution, none of the project loads and I see the below error in the output window:
I don't have global.json in my project. Though I created the dummy one and provided SDK version 3.1.101 in that; however, it didn't work.
How can I know which version my project is trying to get and throwing this error?
.csproj doesn't have any specific SDK version mentioned. You mean which version? Host project .csproj file has TargetFramework netcoreapp2.1 and remaining projects are netstandard 2.0
3 Answers 3
For my case, it works while checking dotnet --version, dotnet --list-sdks etc. Environment variables also set correctly. Everything looks fine but when I tried to Load the Xamarin Forms project, it keep throwing this error.
Even if I create new Xamarin Forms project, the Android and iOS are there, but the Forms failed to load.
After trying here and there, my solution was to delete the folder at C:\Program Files (x86)\dotnet, because I have already got the working Core at C:\Program Files\dotnet. I think Visual Studio looked for the library at x86 first, before trying in x64.
Thanks, I recently upgraded the VS2022 preview and started facing issues with VS2019. I renamed C:\Program Files (x86)\dotnet folder
Re-installation of VS 2019 solved the issue of loading projects.
Step 1
Install Visual Studio Installer
VS Installer should be related to your VS version i.e. 2019/2020/2022
Step 2
If you have installed multiple Visual Studio Versions, all will appear. Look for the one you are using or the one which is not opening the project.
for example I have only Visual Studio 2019 installed so it will only show me VS 2019 else there will be 2021 2022 versions available.
Step 3
There you will see the options to Modify / Uninstall / Update. Update from there, you don't have to delete your project or update anything else. From here, it will update all the necessary items and removes the one not needed.
Removing the items by the VS installer doesnot effects anything. It just replace the new updates available.
It requires I open a project in VS, but when I try to open it I get the following error:
I have the SDK version specified in the JSON and all the other tools specified in the tutorial, but still nada. I think I'm missing a step somewhere. Any help would be hugely appreciated.
14 Answers 14
Step 1) First run dotnet --list-sdks from the command line (as in Grzegorz Smulko's answer). Take note of the greatest version number.
Step 2) Create a global.json file at the root of the solution with the exact version number from step 1. it needs to contain all the digits otherwise it wont work. This is the my version at the time of writing
This fixed my problem, but I don't know why! I have other projects without this file that are working.
As per @Gopi, I found that the file did exist in the root folder, but the version number in it was for an old SDK that I did not have installed. I ran "dotnet --list-dsks" to find the most recent and updated the file with the correct SDK number. The solution then loaded.
@CSharper: VS looks for parent folder chain also for global.json. Probably you particular folder did not contain global.json, but some parent folder did contain one, which defined a version explicitely, which you did not have. So if the particular folder you overwrite it, now it works. Also your other projects reside in a folder where there are no global.json at all so no restrictive constraint prevents VS to load
With only the v2.2.203 installed projects didn't load for me in VS2019. I had to install v2.2.105 too.
This answer suffers from not being written in such a way will be accurate in the future, for instance, it’s currently out of date. Which is the reason modifying global.json is the way to go. The author first said v2.2.106 was required but it didn’t work until v2.2.105 was installed.
I had this problem because I uninstalled some older dotnet SDKs. Not only would VS2019 no longer load dotnet core projects, but dotnet was no longer available on my path and so not available on the command line as simply dotnet .
After installing multiple older versions of dotnet and reparing my VS2019 install, I was finally able to fix it by adding C:\Program Files\dotnet\ to my path. Then VS2019 would load the project again.
Also, none of this affected VS2017, which could load and fully work with the project. And it worked on the command line when I specified the full path to the dotnet executable.
Very helpful! In my case, which is reversed: I have 2 paths point to program files\dotnet and program files(x86)\dotnet , I removed sencond one, then visual studio get able to load projects.
today, I found real reason. when I remove second path, the 1st path started working, and projects could be loaded. but once when I switched to another solution which has a global.json , and that json specify a different version of SDKs, then VS will no longer to load both projects. what I did is simply remove global.json , then both solutions start working. so the key reason is: you have right SDK version installed which specified by global.json.
@Dongdong you should make your comment an answer probably or add it as a PS to the answer. It fixed my problem!
I fixed it by installing the x86 version of the SDK.
It looks like each version of Visual Studio has it's own corresponding dotnet version that it builds on. This is due to msbuild requirements.
As detailed on that page, you'll need the following versions of dotnet for each visual studio version:
This fixed it for me in VS 2019. The issue popped up after I uninstalled VS 2022 preview. I'm not sure if installing the preview was the issue or uninstalling it was as I didn't use VS 2019 while the preview was installed.
Make sure that there are no global.json files further up in your directory structure that are screwing things up.
This is probably the right solution. Don't go downloading lots of differnet SDKs.This solution will suffice.Thanks WillT for sharing.
In my case, remove program files(x86)\dotnet in Environment path then restart visual studio and it worked.
In my case I did not have C:\Program Files\dotnet among PATH environment variables (neither C:\Program Files (x86)\dotnet). After I've added the first one, it got OK. Thanks for the hint (to reload VS :) )
That seems to be a bug in dotnet x86 version.
I just changed x64 dotnet (C:\Program Files\dotnet) to be before x86 dotnet (C:\Program Files (x86)\dotnet`) in the %PATH% environment variable and it worked just fine.
Welcome to Super User! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
Similar issue here. looks like deleting the x86 dotnet folder fixes it, so that the system can find the one it "should" be finding.
I had the same error a while back which caused my web api projects to fail during the solution loading process.
I faced this problem in vs 2019 v16.3 I have uninstalled old versions of netcore 2.1 SDK except version 2.1.801.
I found a file global.json in the folder: c:\Users\admin (my login user is admin) that point to uninstalled version 2.1.602
Although netcore SDK version 2.1.801 is installed, it's not used because it doesn't match the Patch number.
The patch version is defined by the last two digits (yz) in the last portion of the number (xyz) for SDK versions 2.1.100 and higher. For example, if you specify 2.1.300 as the SDK version, SDK selection finds up to 2.1.399 but 2.1.400 isn't considered a patch version for 2.1.300.
I modified the file to point to 2.1.801 and it's working fine
My project has no global.json at the root, creating one with the the latest (3.1.201) from dotnet --list-sdks didn't help. WTF?
I was able to fix the VS 2019 issue with the below steps
- Run dotnet --list-sdks to know the exact version of the SDK installed
- Modify the global.json file in the root folder of the project (In my case it was showing 2.2.100 but I had 2.2.401 installed, I edited the same to point to that version and I was able to reload the projects
I tried everything listed in the answers with the same error in VS 2019 and ultimately the thing that wound up fixing it was following these steps:
Right-clicked on Solution and hit 'Resolve Errors'
If you see this error with Visual Studio 16.8, update NuGet.exe to 5.8.0
Another possibility is that there is a mismatch between the versions. Type in dotnet --version in the terminal and check the default version. If you get a different version than expected, you can set the exact version you want used by VS by using the global.json file as instructed in other answers.
Highly active question. Earn 10 reputation (not counting the association bonus) in order to answer this question. The reputation requirement helps protect this question from spam and non-answer activity.
Related
Hot Network Questions
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
Site design / logo © 2022 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2022.5.9.42071
VS Code version:
1.40
Steps to reproduce
Expected behavior
Actual behavior
The text was updated successfully, but these errors were encountered:
FlyingWraptor commented Nov 10, 2019
GhostShot3 commented Nov 11, 2019
Failed to install
gregg-miskelly commented Nov 11, 2019
Please, don't install the 3.0-rc1 SDK -- that is an outdated release candidate.
GhostShot3 commented Nov 12, 2019
Yes i install i tryed and say already installed
gregg-miskelly commented Nov 12, 2019
Can you try uninstalling it and reinstalling it? I suspect something went wrong with the first install.
GhostShot3 commented Nov 15, 2019
Worked, thank you
nightblade9 commented Dec 3, 2019
Just wanted to chime in and say I saw the same problem, with the same resolution.
It looks like VSCode was picking up the MSBuild/etc. from the Mono folder (mine was Mono 6.0 for some reason), but anyway, reinstall for the win.
(I'm on Linux if that matters)
MikaelElkiaer commented Dec 17, 2019 •
I have this problem when starting VSCodium with drun.
Starting VSCodium from zsh and it works as expected.
Can anyone explain what the different in these two methods could be? Something related to paths I imagine.
Update: Actually, I do get what I expected from dotnet --info when running that in a terminal.
And if I have one instance of VSCodium open that I started from terminal. Any extra instances I open with drun now works.
Update 2: It was strictly a VSCodium issue, works fine in VSCode.
newVincentFong commented Jan 16, 2020
Exit VSCode and open it.
I try not to exit vscode on my mac when it's connected to a monitor because vscode has some
GPU rendering problem in this circumstances. This habbit leads to the problems.
agawasare commented May 21, 2020
JoeRobich commented May 21, 2020
JackTiber commented May 28, 2020
This issue pops up on Ubuntu 20.04 following both links above, when installing using APT, snap or the script cited. I can run which dotnet and verify the sdk binary is in PATH, but when opening vs code from the same terminal session using code . it still throws the errors around the missing SDK.
gregg-miskelly commented May 28, 2020
This issue isn't a problem with this extension -- this is either a problem with VS Code, or with your shell. There is instructions in there on debugging VS Code if you are so inclined.
JackTiber commented May 28, 2020
@gregg-miskelly thanks for the link! So oddly, that did help with VS Code popup regarding a missing SDK, but then in the actual output logs of the Omnisharp plugin's language server, it still fails to find an SDK binary to use. Originally, I had the sdk installed via APT, but most recently used SNAP to see if that worked.
At this point, I am going to do a full wipe of the machine and start from scratch, to also support a couple of hardware updates I am making. Will check back in either way, but definitely a lot of issues installing it on LTS versions of Ubuntu.
Cabola commented Jun 2, 2020
If there's still people having this issue then try this:
- From start menu search for "this pc", right click and select properties.
- Click Advanced system settings
- Click on "Environment Variables. "
- Select either the Users or Systems "Path" variable and click Edit.
- In either of them you should find the path to your "dotnet" folder
now in my case I had 2 C:\Program Files (x86)\dotnet\ and C:\Program Files\dotnet\ if you actually go to the folders you'll notice that there's no sdk folder within the C:\Program Files (x86)\dotnet\ folder. So simply select C:\Program Files\dotnet\ and click the "move up" button. Then click OK all the way out of there, now try and see if things are working..
visuallization commented Aug 25, 2020
Drexlin commented Sep 17, 2020
@JackTiber Where you able to solve your issue? I'm having the same problem and wondering if going nuclear is my only option at this point. Thanks.
JackTiber commented Sep 17, 2020
@Drexlin I did. At the end of the day, the best method I found was to remove any trace of the SDK (snap especially which can have even more issues than installing via APT in the docs) and then re-installing using APT. Once it is installed, verify that you can get the binary on your path with which dotnet , but do not try to use it yet. Restart your machine, which I recommend actually shutting down completely and then bringing it back up. At that point, it started working for me.
The link @gregg-miskelly provided is pretty helpful in detailing the troubleshooting steps.
Honestly, if I had to guess this probably has something to do with where the binary is installed on Debian based systems and the spawned shell for the extension / VS Code, which is somehow why the restart makes a difference. Some environment variable that isn't set after installation is probably set during startup and fixes the issue. Recently worked with a Fedora 32 machine and had all of 0 problems getting the SDK installed and working with the extension and code.
Drexlin commented Sep 18, 2020
@JackTiber Thanks, I will try that. If I can't get it to work, maybe I'll give CentOS a try.
gp200918 commented Sep 25, 2020 •
I made this post already here and here.
Start VSCode with a script file with this content:
export PATH=$PATH:/YYY/
/home/XXX/Downloads/VSCode/code-insiders
where you have to adapt XXX and YYY to your case.
YYY is the folder where you have stored the SDK.
DO NOT USE Ubuntu snap.
Someone working on snap dotnet-sdk must have introduced an automatic "dotnet" alias that is listed but can not be removed with the "sudo snap unalias dotnet" command because Error: "cannot find manual alias "dotnet" in any snap".
Unfortunately the people working on omnisharp do not care about this problem.
From my console:
Usage: dotnet [options]
Usage: dotnet [path-to-application]
path-to-application:
The path to an application .dll file to execute.
xxx: $ snap aliases
Befehl Alias Anmerkungen
dotnet-sdk.dotnet dotnet -
xxx: $ sudo snap unalias dotnet
Fehler: cannot find manual alias "dotnet" in any snap
Previously:
I made this post already here and here.
On Ubuntu 20.04.1, the problem is the snap alias. Do not install it.
Instead do this:
sudo snap install dotnet-sdk --channel=5.0/beta --classic
DO NOT install the alias because it makes Omnisharp not find the SDK.
sudo snap alias dotnet-sdk.dotnet dotnet
It can be removed with:
sudo snap unalias dotnet
Start VSCode with a script file with this content:
export PATH=$PATH:/snap/dotnet-sdk/current/
/home/XXX/Downloads/VSCode/code-insiders
You have to adapt the second line, that starts VSCode insiders, to your case.
Читайте также: