I'm using VSCode 1.19 and trying to "Go>Go to definition" in a C# file like in Visual Studio and it does nothing. In a.js file it works well and i'm guessing if there is some workaround this.
There may be multiple "projects" in the folder and VSCode has selected the "wrong" one. (in VSCode terms "project" means the sln file)
Use ctrl-shift-P and select "OmniSharp: Select Project" to select the correct project (a .sln file).
If you have the Output window open with "OmniSharp Logs" selected, you will see it reading your csproj's. Once finished your goto definition will start to work
As written in the comments for @AndyPook's answer, another possible solution is to just restart OmniSharp.
CTRL + SHIFT + P -> OmniSharp: Restart OmniSharp
"Go to definition" was working for me for a long time, but recently stopped working. My solution was:
I had the same problem in VSCode (multiple projects Web API and Angular MVC) and resolved by creating a new sln
file. Please do the following steps:
Step 1: Create the project sln
file. ( ex: MyApp.sln
)
Step 2: Open the sln
file and paste this code:
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyApp", "MyApp\MyApp.csproj", "{BC407A9C-4BD2-4086-9862-6E5A547D1DD8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BC407A9C-4BD2-4086-9862-6E5A547D1DD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC407A9C-4BD2-4086-9862-6E5A547D1DD8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC407A9C-4BD2-4086-9862-6E5A547D1DD8}.Debug|x64.ActiveCfg = Debug|Any CPU
{BC407A9C-4BD2-4086-9862-6E5A547D1DD8}.Debug|x64.Build.0 = Debug|Any CPU
{BC407A9C-4BD2-4086-9862-6E5A547D1DD8}.Debug|x86.ActiveCfg = Debug|Any CPU
{BC407A9C-4BD2-4086-9862-6E5A547D1DD8}.Debug|x86.Build.0 = Debug|Any CPU
{BC407A9C-4BD2-4086-9862-6E5A547D1DD8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC407A9C-4BD2-4086-9862-6E5A547D1DD8}.Release|Any CPU.Build.0 = Release|Any CPU
{BC407A9C-4BD2-4086-9862-6E5A547D1DD8}.Release|x64.ActiveCfg = Release|Any CPU
{BC407A9C-4BD2-4086-9862-6E5A547D1DD8}.Release|x64.Build.0 = Release|Any CPU
{BC407A9C-4BD2-4086-9862-6E5A547D1DD8}.Release|x86.ActiveCfg = Release|Any CPU
{BC407A9C-4BD2-4086-9862-6E5A547D1DD8}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
Step 3: Crtl + Shift + P to switch on the project.
I resolved by
OniSharp Error: Found dotnet version 5.0.201. Minimum required version is 6.0.100
For anyone using the C# extension and coming here after May 24, 2022: version 1.25.0 of the extension disabled support for a few things
You can follow instructions at that link to get it working with 1.25.0, or you can rollback to version 1.24.4, per GeirS' answer
I had the same problem, but with a TypeScript project folder. The solution was to simply reopen the folder.
I know that I am late to this thread, but restarting omnisharp did not fix this problem for me. What did fix the problem was running 'dotnet restore' and opening the project folder again.
PLUGGIN VSCODE "ANgular Language Service"
Try Using Shift+Fn+F12 if all required extension are installed depends on your system config
In my case, the answer by @Abdul Saboor sent me in the right direction. I checked the logs and it turns out the .NET 6 is required for this functionality.
I face same probleam today, try to move my self from Visual Studiod to Code, As My porject is Microservie based , i have multiple Solution and repos with respect to each microservice , for make CI/CD simple, Now where the VS code Feature of Multipel Root Work Space helping me, So please follow below step if you are Setting up VS Code from professional developement prospect as c# developer,
Crtl+shif+P : Workspace:open Configuration file you can setup compound launch setting as well after that, to open multiple sln in debug mode at same time, like below one: "launch": { "configurations": [
], "compounds": [ { "name": "Launch Server & Client", "configurations": [ "CMSAPI",// Each indivisual sln launch setting unique name "Core" ] } ]
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.