OmniSharp.MSBuild.ProjectManager Attempted to update project that is not loaded:
Asked Answered
D

18

59

I started to develop Asp.net Core web API with the VS code. But when I typing the code Intellisense/Suggestions not working properly. I saw in some resource on the internet while they are typing using Microsoft., EntityFrameworkCore showing as a suggestion. But In my case, it's not showing. In the OmniSharp log showing following error to me.

Starting OmniSharp server at 4/5/2019, 3:37:16 PM
    Target: c:\Dotnet Core\NgWebApi

OmniSharp server started.
    Path: C:\Users\Acer\.vscode\extensions\ms-vscode.csharp-1.18.0\.omnisharp\1.32.11\OmniSharp.exe
    PID: 13684

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Windows 6.2.9200.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 15.0 - "C:\Users\Acer\.vscode\extensions\ms-vscode.csharp-1.18.0\.omnisharp\1.32.11\msbuild\15.0\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to 'C:\Users\Acer\.vscode\extensions\ms-vscode.csharp-1.18.0\.omnisharp\1.32.11\msbuild\15.0\Bin\MSBuild.exe'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 15.0 - "C:\Users\Acer\.vscode\extensions\ms-vscode.csharp-1.18.0\.omnisharp\1.32.11\msbuild\15.0\Bin"
            CscToolExe = csc.exe
            CscToolPath = C:\Users\Acer\.vscode\extensions\ms-vscode.csharp-1.18.0\.omnisharp\1.32.11\msbuild\15.0\Bin\Roslyn
            MSBuildExtensionsPath = C:\Users\Acer\.vscode\extensions\ms-vscode.csharp-1.18.0\.omnisharp\1.32.11\msbuild
            MSBuildToolsPath = C:\Users\Acer\.vscode\extensions\ms-vscode.csharp-1.18.0\.omnisharp\1.32.11\msbuild\15.0\Bin
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in 'c:\Dotnet Core\NgWebApi'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.WorkspaceInitializer
        Project system 'OmniSharp.DotNet.DotNetProjectSystem' is disabled in the configuration.
[info]: OmniSharp.MSBuild.ProjectSystem
        No solution files found in 'c:\Dotnet Core\NgWebApi'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'c:\Dotnet Core\NgWebApi\NgWebApi.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in 'c:\Dotnet Core\NgWebApi'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: c:\Dotnet Core\NgWebApi\NgWebApi.csproj
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location 'c:\Dotnet Core\NgWebApi' on host 17188.
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file 'c:\Dotnet Core\NgWebApi\NgWebApi.csproj'.
c:\Dotnet Core\NgWebApi\NgWebApi.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk.Web' specified could not be found.  c:\Dotnet Core\NgWebApi\NgWebApi.csproj
   at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args)
   at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement importElement, List`1& projects, Boolean throwOnFileNotExistsError)
   at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement)
   at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
   at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
   at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(ILoggingService loggingService, BuildEventContext buildEventContext)
   at Microsoft.Build.Evaluation.Project.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings)
   at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings)
   at Microsoft.Build.Evaluation.Project.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings)
   at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings)
   at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary`2 globalProperties, String toolsVersion)
   at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore(String filePath)
   at OmniSharp.MSBuild.ProjectLoader.BuildProject(String filePath)
   at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load(String filePath, ProjectLoader loader)
   at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject(String projectFilePath, Func`1 loader)

[fail]: OmniSharp.MSBuild.ProjectManager
        Attempted to update project that is not loaded: c:\Dotnet Core\NgWebApi\NgWebApi.csproj

I re-installed the VS Code and C# , C# Extention to solve this problem, but it's still occurring. I think the reason was to not showing Intellisense/Suggestions the project is not properly loaded. Can anyone tell me how to avoid this error and how to solve Intellisense/Suggestions not showing the issue.

Delsiedelsman answered 5/4, 2019 at 12:15 Comment(0)
D
6

To solve this I did several things. First of all, I downgrade OmniSharp version by installing their beta version. download the .vsix file for that release to my machine. Used the following steps to install the .vsix into Visual Studio Code.

  1. Open Visual Studio Code and select View->Extensions from the menu to display the Extensions pane
  2. By clicking the ... at the top-right corner of the Extensions pane and select "Install from VSIX..." on the menu.
  3. Located the .vsix the file I downloaded and Opened it
  4. Then restart vs code

But the problem still occurred, so then I downgraded the .Net core SDK v2.2.202 version to 2.1.202 and the problem is solved.

Updated: Had to face the same issue again after reinstalling VS Code, resolve by.

  1. In the visual studio code menu, go into File > Preferences > Settings. or Press Ctrl+++,

  2. In the Search Setting field, Type omnisharp.path

  3. Click on Edit in settings.json.

in there Add / Edit like this,

{
  "omnisharp.path": "latest"
}

If your settings.json already had entries in it, put a comma behind the last one and add the line like this:

{
  "workbench.colorTheme": "Solarized Light",
  "omnisharp.path": "latest"
}

Finally, save the settings.json

You'll see a prompt: "OmniSharp configuration has changed. Would you like to relaunch the OmniSharp server with your changes?" Click the "Restart OmniSharp" button to reload it.

In the Output window, you can see updates while the latest version downloads

Delsiedelsman answered 6/4, 2019 at 7:7 Comment(0)
A
118

Solved (cross checked on Ubuntu 16.04 and CentOS 7):

In the VS Code menu, go into File / Preferences / Settings.

In the "Search settings" window, type omnisharp.path

Click on "Edit in settings.json" link.

Add (or edit) like this: "omnisharp.path": "latest"

(from: https://github.com/OmniSharp/omnisharp-vscode/issues/2965)

Augmentation answered 16/4, 2019 at 7:56 Comment(8)
This solution worked for me: Win 10, VSCode: 1.32.3 and .Net Core 2.2.301Merlon
Mac OS X 10.15 running VS Code 1.40.2 My settings.json did not have this entry. As soon as I added it omnisharp reinstalled itself and voila intellisense is back. Thanks @AugmentationCensorship
I did this but it did not fix the problem.Borak
I upgraded the dotnet packages on my Ubuntu 20.04 system yesterday. There appears to have been a breaking change which impacted omnisharp. However, the latest version of omnisharp worked fine with the newer dotnet packages. Setting "omnisharp.path": "latest" caused VS Code to update omnisharp automatically for me, which resolved the broken intellisense problem.Zephyr
Fixed the intellisense but did not fix the "OmniSharp.MSBuild.ProjectManager Attempted to update project that is not loaded" error. See below answer on setting Omnisharp Use Global Mono to "always".Chicken
I was using linux and had to set "omnisharp.useModernNet": trueCrocus
On MacOS I also had to go into the C# extensions and set omnisharp.useModernNet to false (in addition to setting omnisharp.path to latest in the main vscode settings)Psychiatrist
Changing "omnisharp.path": "latest" worked for me.Saw
I
66

I solved this issue by doing the following on VSCode:

  1. Go to settings. (Code -> Preferences -> Settings on Mac)
  2. Search "omnisharp".
  3. Find the section "Omnisharp: Use Global Mono," and set it to "always."
  4. Find the section "Omnisharp: Path," and click "Edit in settings.json." Change "omnisharp.path" as "omnisharp.path": latest".
  5. Reload the window.
Interclavicle answered 26/8, 2020 at 18:46 Comment(7)
You saved my day. I was looking for a solution from a month.Tribasic
This pointed me to the right direction, but I had to set it to "never". I think because I have both core 3.1 and core 5 installed. It looks like I needed the local Mono, not the global one. – RailinginDFW 1 hour agoThermophone
I had to do both things before it worked: 1. from the answer above, change settings to "omnisharp.path": "latest" and it downloaded OmniSharp into my copy of VSCode. Then 2. Use global mono: always like you suggested. It was a group effort. Thanks!Lawful
I did as @Marquizzo described and I have both core 3.1 and core 5 loaded.Gupton
I edited the answer based on your suggestion @Marquizzo . I think it's more robust with the "omnisharp.path": "latest", as the problem sometimes reoccurred without it.Interclavicle
This completely worked! Thank you so much!Mccary
Use Global Mono setting does not exist for me.Horsey
K
16

I found another solution since none of the other solutions were working for me and i was searching for hours.(07/08/2021):

I got the same error with .NET, .NET Core or .NET Framework, here are some screenshots of the errors:

Error popup

Error output

In the error output, it says to install the Developer Pack for this framework version. You can find the version in the .csproj file:

enter image description here

By installing the .NET Framework of this version on the dotnet microsoft site: .NET Framework download list i fixed the error after reloading VSCode and got my Intellisense working for Unity.

TLDR: My fix was too install .NET Framework version 4.7.1

Kalie answered 7/8, 2021 at 18:29 Comment(2)
Working in VSCode 1.60.0Gibbeon
Here is the direct offline installer. It fixed the issue for me: dotnet.microsoft.com/download/dotnet-framework/thank-you/…Otranto
D
6

To solve this I did several things. First of all, I downgrade OmniSharp version by installing their beta version. download the .vsix file for that release to my machine. Used the following steps to install the .vsix into Visual Studio Code.

  1. Open Visual Studio Code and select View->Extensions from the menu to display the Extensions pane
  2. By clicking the ... at the top-right corner of the Extensions pane and select "Install from VSIX..." on the menu.
  3. Located the .vsix the file I downloaded and Opened it
  4. Then restart vs code

But the problem still occurred, so then I downgraded the .Net core SDK v2.2.202 version to 2.1.202 and the problem is solved.

Updated: Had to face the same issue again after reinstalling VS Code, resolve by.

  1. In the visual studio code menu, go into File > Preferences > Settings. or Press Ctrl+++,

  2. In the Search Setting field, Type omnisharp.path

  3. Click on Edit in settings.json.

in there Add / Edit like this,

{
  "omnisharp.path": "latest"
}

If your settings.json already had entries in it, put a comma behind the last one and add the line like this:

{
  "workbench.colorTheme": "Solarized Light",
  "omnisharp.path": "latest"
}

Finally, save the settings.json

You'll see a prompt: "OmniSharp configuration has changed. Would you like to relaunch the OmniSharp server with your changes?" Click the "Restart OmniSharp" button to reload it.

In the Output window, you can see updates while the latest version downloads

Delsiedelsman answered 6/4, 2019 at 7:7 Comment(0)
B
6

For the recent version of Omnisharp just uncheck the useModernNet in VS code C# extension setting as shown in the screenshot.enter image description here

Baking answered 30/7, 2022 at 10:12 Comment(3)
Confirmed working on Mac with Unity Version 2021.3.13f1.Ruthenian
This fixed it for me on Linux Pop OS 22.04 (Ubuntu based)Highlander
This fixed for me on Mac M2 Max Pro. Thanks !!!Gt
A
3

I solved this by upgrading my Mono project version https://www.mono-project.com/

Antiquate answered 12/11, 2019 at 15:28 Comment(3)
This worked and actually was recommended by the Unity for Visual Studio Code guide.Bordiuk
Note that if you have Visual Studio for Mac installed and auto updates enabled, it will download a version of the Mono MDK that is greater than the version specified on the Mono website for the "Visual Studio Channel". That aside, the key to making it work in my situation was to uninstall/reinstall the "C#" extension and then follow the solution by ege to set the VS Code setting "Omnisharp: Use Global Mono" to "always". Now both of these IDEs work as expected.Kermis
Extra note: Go to settings and disable to "omnisharp.useModernNet".Kinkajou
M
2

If you are running on an older .NET project (<.NET 6), setting useModernNet to false will allow OmniSharp to target the right .NET framework version.

In settings.json:

"omnisharp.useModernNet": false

Alternatively, this can be done through VS Code's settings pane: File>Preferences>Settings and search for omnisharp.useModernNet and untick the checkbox for Omnisharp: Use Modern Net.

Maxson answered 1/10, 2022 at 10:21 Comment(1)
I just tried this and worked for me (VS Code 1.74.3 and Unity 2021.3.8f1 in Mac). When you set the value to false, then restart VSCHebert
R
1

Solved: Check if Visual Studio Build Packages is installed, if so uninstall it. As soon as uninstall VScode will work fine and intellisense feature will be back. Good luck!

Roger answered 12/5, 2019 at 15:59 Comment(1)
Verified for Visual Studio Code 1.40.2 (User Setup), .NET Core 3.1 Console App, and Windows 10 Pro 1803Kurman
A
1

I was also facing the same issue. If none of the above solutions worked then you can try the one below.

While going through the logs, I realized the real problem: "The SDK 'Microsoft.NET.Sdk' specified could not be found."

I installed latest stable Mono from here (6.8.0): https://www.mono-project.com/download/stable/

Then opened ~bash_profile and exported framework path of mono: export FrameworkPathOverride=/Library/Frameworks/Mono.framework/Versions/Current

Works fine for me. Hope it works for you too.

Antimonyl answered 22/6, 2020 at 13:46 Comment(0)
F
1

This started happening after the latest Windows10 update.

Re-installed .NET Core Runtime and everything's fine now.

Firstnighter answered 17/7, 2020 at 15:13 Comment(0)
T
1

In My case, I deleted the obj folder in Visual Studio code. Closed & reopened Visual Studio Code and rebuild the project. It worked after that.

Tersina answered 1/3, 2023 at 20:1 Comment(0)
D
0

I've had both VSCode and Visual Studio installed on my mac. Uninstalling Visual Studio with this official guide solved the issue.

Dearman answered 9/6, 2020 at 6:9 Comment(0)
R
0

Another reason this might fail, is when you have Visual Studio 2019 16.7 or below installed, as OmniSharp reqiures MsBuild from 16.8.

Updating Visual Studio using the Visual Studio installer resolved that issue for me, while I was using a replacement machine, that lay dormant for a while now.

Rubalcava answered 23/1, 2021 at 15:59 Comment(0)
M
0

If you installed the SDKusing snap / ubuntu software.. that is what caused the same error for me. I answered my own similar question here

Megass answered 4/6, 2021 at 16:57 Comment(0)
D
0

Actually the omnisharp path doesn't work for me. I'm on mac. What i did eventually is to download an early version of .net, not the latest 5.

https://dotnet.microsoft.com/download/dotnet/thank-you/sdk-3.0.103-macos-x64-installer

Dannie answered 22/9, 2021 at 2:18 Comment(0)
S
0

In my case creating C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages folder solved the problem

Scrapbook answered 20/3, 2022 at 20:33 Comment(0)
R
0

In my particular case, I was able to solve the Attempted to update project that is not loaded: problem by running dotnet restore across my solution.
It seems I was missing my dependencies.

Responsiveness answered 25/9, 2022 at 15:59 Comment(0)
Y
0

In my case I hade package version conflicts between the projects which are added to the solution. Resolving the conflict and rebuild the project solved the issue.

Yuyuan answered 14/7, 2023 at 5:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.