Can't locate SDK - VSC - c#

My initial error, in fact, comes from Unity that when I open a script (C#) from it to Visual Studio Code, it opens the code without "auto-completing" my lines of code, which makes learning more difficult.
To solve this problem, I used several tutorials, but none helped. That's why I decided to solve another problem that always appears when I open the Microsoft App, which is "The .NET Core SDK cannot be located: A valid dotnet installation could not be found.".
I installed the dotnet 6.0.44 version on my linux (zorin os 16.2) from commands on the official website and the OS identified it. However, no matter what I do, Visual Studio does not recognize it, not even in the terminal does it find it .
command contradiction
Dotnet version
obs:
Already re-installed SDK

I've had the same error on Zorin OS and other Ubuntu based distributions,
you have to install the SDK by this command:
$ sudo apt-get update && sudo apt-get install -y dotnet-sdk-7.0
If this gives you any errors, read the documentation here.
You can view your installed SDKs by executing
$ dotnet --list-skds

Related

Dotnet commands not working even after installing .NET core SDK

I am trying to setup visual studio code for c# on Manjaro Linux
I have installed VSC and .NET core 5.0 SDK through the package manager.
The c# add-on is installed in VSC
With all of these installed correctly, why can't I use the dotnet command in the terminal?
Every time I try I get this error; sh: dotnet: command not found
By default, dotnet is installed to usr/share/dotnet. Check if this path is added to the env var $PATH.
If you can't find it there, you could run on a terminal:
whereis dotnet
If no dotnet is found, the tool wasn't properly installed.
Also, did you close and reopen the terminal window after installing the SDK, as the instructions stated?

Installed Dotnet tools give error "Could not execute because the specified command or file was not found." on Ubuntu WSL2

I'm working on an api in .net core 5 in wsl2 and I followed all the documentation to install the entity framework core tools.
when i run
dotnet tool list -g
it prints
Package Id Version Commands
--------------------------------------
dotnet-ef 5.0.7 dotnet-ef
but when i run
dotnet ef
or any of its child commands, I get this
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* You intended to execute a .NET program, but dotnet-ef does not exist.
* You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
now, i've looked in my path and it looks like when i ran
dotnet tool install --global dotnet-ef
it installed it under my C drive instead of inside wsl2 which I think might be the problem but I don't understand why running that within ubuntu would install it into my windows directories but this is the line from my path
/mnt/c/Users/ethan/.dotnet/tools
so i guess my question is, is the issue that it unstalled under my windows directories and if so how do i either force it to install on ububtu or change my path and if not what is happening.
i found this post:
Cannot find command 'dotnet ef'
and running
export PATH="$PATH:$HOME/.dotnet/tools/"
makes dotnet ef work until i start a new terminal session so i wanted to double check the right way to make this a permanent fix, according to this article i found https://astrobiomike.github.io/unix/modifying_your_path the best way to handle it is just to add it to your bash_profile or zshrc so thats what i did

Cannot start lambda with Mock Lambda Test Tool

I've been working with AWS lambdas for a few months. I was working with a lambda and it was fine at the end of the day. I came back to work on it the next day, and I can't get Visual Studio to even start the application using the Mock Lambda Test Tool.
I ended up creating an empty lambda that just returns the input (the standard project code that AWS gives you as a template) and that won't even run. I hit the play button to star the Mock Lambda Test Tool, it looks like it will run for a couple seconds, then it closes down. The command window does not even pop up.
This is the code from the template project.
public string FunctionHandler(string input, ILambdaContext context)
{
return input?.ToUpper();
}
This is all I get in the output window of VS:
The target process exited without raising a CoreCLR started event.
Ensure that the target process is configured to use .NET Core. This
may be expected if the target process did not run on .NET Core. The
program '[16700] dotnet-lambda-test-tool-2.1.exe: Program Trace' has
exited with code 0 (0x0). The program '[16700]
dotnet-lambda-test-tool-2.1.exe' has exited with code -2147450726
(0x8000809a).
I have tried re-installing the AWS toolkit, and also tried re-installing Visual Studio. This is an issue with VS 2017 and VS 2019. I just installed 2019 to see if that would fix the issue. Any help would be appreciated.
I came to this question having the very same issue. After installing AWS Toolkit I found that the lambda test tool was not installed and therefore I got the same error just as the OP. The only difference is that I was targeting .Net Core 3.1 and therefore I needed amazon.lambda.testool-3.1. However this answer should work for both scenarios.
Unfortunately I did not have the same luck as the OP of having a nice co-worker that could give me the files I needed. So, if this is also your case please continue reading.
In the official project site, which can be found here, there are the instructions to install the tools. It also says that installing the latest version of AWS Toolkit should be enough to have the tools installed (it was not in my case and probably in yours).
It says that in order to install the tools you should run the following commands:
dotnet tool install -g Amazon.Lambda.TestTool-3.1
or
dotnet tool install -g Amazon.Lambda.TestTool-2.1
depending on which tool you need.
However, running these commands fails with the following message:
The tool package could not be restored.
Tool 'amazon.lambda.testtool-2.1' failed to install. This failure may have been caused by:
* You are attempting to install a preview release and did not use the --version option to specify the version.
* A package by this name was found, but it was not a .NET Core tool.
* The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
* You mistyped the name of the tool.
For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool
And since the project is still in preview I just had to find the latest stable version in order to specify it in the command. For .net core 3.1 here is the nuget site, there I found version 0.10 to be the latest, so the command should look like:
dotnet tool install -g --version 0.10 Amazon.Lambda.TestTool-3.1
I have faced the same issue and when i tried to install dotnet-lambda-test-tool-3.1.exe using command prompt I got this issue:
Failed to create shell shim for tool 'amazon.lambda.testtool-3.1': Command 'dotnet-lambda-test-tool-3.1' conflicts with an existing command from another tool.
Tool 'amazon.lambda.testtool-3.1' failed to install.
And I did the following to fix issue
Deleted the dotnet-lamda-test-tool-3.1.exe from the installed folder (C:\Users%USERNAME%.dotnet\tools\dotnet-lambda-test-tool-3.1.exe)
Run dotnet tool install -g --version 0.10 Amazon.Lambda.TestTool-3.1 on cmd.
I have faced the same issue and got errors like "dotnet-lamda-test-tool-2.1.exe has exited with code.."
I did the following to fix the issue
Removed the dotnet-lamda-test-tool-2.1.exe from the installed folder
(C:\Users%USERNAME%.dotnet\tools\dotnet-lambda-test-tool-2.1.exe)
Removed the [amazon.lambda.testtool-2.1] folder as well
(C:\Users%USERNAME%.dotnet\tools\tools.store\amazon.lambda.testtool-2.1)
Installed dotnet tool from Developer command prompt using the command
[install -g Amazon.Lambda.TestTool-2.1]
Run the project. It is working
I have seen this issue many time on my system with dotnet-lambda-test-tool-6.0. Only one fix work for me
Remove dotnet-lambda-test-tool-6.0.exe from C:\Users\username.dotnet\tools
Open Command prompt from C:\Users\username.dotnet\tools
run command dotnet tool install -g Amazon.Lambda.TestTool-6.0
For anyone else that hits this same issue, it had to do with the the AWS toolkit install. I did not modify it, but somehow it was no longer working. I tried un-installing and re-installing, but it was still having issues running it. A co-worker sent me the exe and subdirectory that was setup on his machine under C:\Users\%user%.dotnet\tools. The exe is located in this directory, and there is another folder under .store for amazon.lambda.testtool-2.1. That directory had different folders and files than what I was able to install. So I copied in what he had and it worked. There might be a profile file associated to the tools install that points to these folders and files that might need to be modified. Since I was able to fix it with this, I didnt look any further into that.
I had the same issue with my .NET 6.0 lambda project. I installed the tool by executing dotnet tool install --global Amazon.Lambda.TestTool-6.0 --version 0.12.6 as suggested on https://www.nuget.org/packages/Amazon.Lambda.TestTool-6.0
Just ensure it is installed at %USERPROFILE%\.dotnet\tools\dotnet-lambda-test-tool-6.0.exe
I got the same issue with VS2019 with lambda design in 3.1 version and in Output window getting error
The target process exited without raising a CoreCLR started event. Ensure that the target process is configured to use .NET Core. This may be expected if the target process did not run on .NET Core.
Then checked the folder having multiple version of lambda-test-tool in path
C:\Users{username}.dotnet\tools
I removed all the lambda-test-tool and installed the required tool only with version 3.1 by command in developer command prompt:
dotnet tool install -g --version 0.10 Amazon.Lambda.TestTool-3.1
Then I can able to debug the lambda

Issues "getting started" with Blazor

I'm trying to "get started" with Blazorfollowing Microsoft's guidelines,
I've installed the .NET Core 3.0 Preview SDK as indicated,
but then I try to run the command
dotnet new -i Microsoft.AspNetCore.Blazor.Templates::3.0.0-preview5-19227-01
respectively from terminal and powershell both as admin and not,
getting this error:
Did you mean to run dotnet SDK commands? Please install dotnet SDK from:...
I proceeded anyway installing Visual Studio Preview (with Blazor Extension)
to be able to run the command form the Visual studio terminal,
but I'm simply getting this error:
Command "dotnet" is not valid.
Looks like doesn't recognize the installed SDK (3.0 or previous),
any idea how can I solve the issue? thanks in advance
I imagine if you've got multiple of the same executable in your path then it can't resolve which one you're trying to call.
Try manually using the full path to the .NET Core 3.0 SDK dotnet.exe in a command line e.g.
"C:\Program Files\dotnet\dotnet.exe" new -i Microsoft.AspNetCore.Blazor.Templates::3.0.0-preview5-19227-01 (you can use dotnet --version to find the version of the exe if you're unsure which is which)

How to run .NET 4.5 on XSP using Mono?

I have installed Mono 3 however when I run xsp or xsp4 it shows that I'm using .NET 4.0. I need to have .NET 4.5. Is it possible? Where can I configure it?
I've seen this page but I don't have any of those folders where I downloaded sources.
This is what it shows when I enter website by running xsp4:
Version Information: 3.2.7 (master/1eef047 C nov 28 18:16:30 EET 2013); ASP.NET Version: 4.0.30319.17020
How I installed Mono and XSP
Firstly I downloaded Lubuntu 13.10 32bit and launched it inside VirtualBox. Then did apt-get update and apt-get upgrade. After that rebooted the system.
Make sure all commands are executed as super user.
sudo -s
Got dependencies
apt-get install autoconf automake libtool g++ gettext libglib2.0-dev libpng12-dev libfontconfig1-dev mono-gmcs git
Downloaded sources of Mono and XSP
cd /opt
git clone git://github.com/mono/mono.git
git clone git://github.com/mono/xsp.git
Installed latest stable Mono from github
cd /opt/mono
./autogen.sh --prefix=/usr
make
make install
Installed latest stable XSP from github
cd /opt/xsp
./autogen.sh --prefix=/usr
make
make install
Tested that I have 4.0 running on XSP instead of 4.5
cd /home/pc/web
xsp4 # 4.0
xsp2 # 2.0
xsp # 2.0
My configuration
/usr/bin/xsp4 looks like it should use 4.5. Just like this answer suggested. Also, I don't have xsp4.exe in my /usr/lib/mono/4.0/ only in /usr/lib/mono/4.5/ so I cannot copy anything like suggested in that answer.
#!/bin/sh
exec /usr/bin/mono $MONO_OPTIONS "/usr/lib/mono/4.5/xsp4.exe" "$#"
You say "I don't have any of those folders where I downloaded sources" referring to /opt/mono/bin/xsp4. But you're confusing things, and I know it because you shared how you installed mono.
/opt/mono should not be the place where you clone the mono repository to compile it. You should clone it somewhere else like your home folder. I.e.: /home/username/code/mono.
/opt/mono is where usually people install a custom version of mono. The way they do it is passing this path to the --prefix argument. But you're passing /usr as the prefix argument! So then you're installing it to a different location compared to the SO answer that you point out.
Also, it is not recommended that you do ALL those operations as a superuser. You normally compile code without root privileges, and you only need sudo for the install phase. So don't do "sudo -s" before everything. Just compile, and when you're done, do sudo make install. This will also make you have binaries that are not owned by root.

Categories

Resources