vscode-csharp: Fail: OmniSharp.MSBuild.ProjectManager, Attemped to update project that is not loaded
Environment data
dotnet --info
output:
.NET Core SDK (reflecting any global.json):
Version: 2.1.300
Commit: adab45bf0c
Runtime Environment: OS Name: Windows OS Version: 10.0.17134 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.1.300\
Host (useful for support): Version: 2.1.0 Commit: caa7b7e2ba
.NET Core SDKs installed: 1.0.0 [C:\Program Files\dotnet\sdk] 2.1.300 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 1.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
VS Code version: 1.27.1 C# Extension version:
Steps to reproduce
OmniSharp is updated itself
Expected behavior
Project to be working
Actual behavior
OmniSharp Log:
OmniSharp server started.
Path: C:\Users\Burak\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\OmniSharp.exe
PID: 8796
[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\Burak\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to 'C:\Users\Burak\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin\MSBuild.exe'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: StandAlone 15.0 - "C:\Users\Burak\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin"
CscToolExe = csc.exe
CscToolPath = C:\Users\Burak\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin\Roslyn
MSBuildExtensionsPath = C:\Users\Burak\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild
MSBuildToolsPath = C:\Users\Burak\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin
[info]: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in 'c:\SwayPay-Marketing\ota-app-hotelbeds-content'.
[info]: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
[info]: OmniSharp.Stdio.Host
Project system 'OmniSharp.DotNet.DotNetProjectSystem' is disabled in the configuration.
[info]: OmniSharp.MSBuild.ProjectSystem
Detecting projects in 'c:\SwayPay-Marketing\ota-app-hotelbeds-content\HotelContentFetcher.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\SwayPay-Marketing\ota-app-hotelbeds-content\Fetcher\HotelContentFetcher.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\SwayPay-Marketing\ota-app-hotelbeds-content\FetcherTests\FetcherTests.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in 'c:\SwayPay-Marketing\ota-app-hotelbeds-content'.
[info]: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
[info]: OmniSharp.Stdio.Host
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.Stdio.Host
Configuration finished.
[info]: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location 'c:\SwayPay-Marketing\ota-app-hotelbeds-content' on host 16256.
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: c:\SwayPay-Marketing\ota-app-hotelbeds-content\Fetcher\HotelContentFetcher.csproj
[info]: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'c:\SwayPay-Marketing\ota-app-hotelbeds-content\Fetcher\HotelContentFetcher.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
Adding project 'c:\SwayPay-Marketing\ota-app-hotelbeds-content\Fetcher\HotelContentFetcher.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: c:\SwayPay-Marketing\ota-app-hotelbeds-content\FetcherTests\FetcherTests.csproj
[fail]: OmniSharp.MSBuild.ProjectLoader
The "GetReferenceNearestTargetFrameworkTask" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Users\Burak\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin" directory.
[warn]: OmniSharp.MSBuild.ProjectManager
Failed to load project file 'c:\SwayPay-Marketing\ota-app-hotelbeds-content\FetcherTests\FetcherTests.csproj'.
c:\SwayPay-Marketing\ota-app-hotelbeds-content\FetcherTests\FetcherTests.csproj
C:\Users\Burak\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1657,5): Error: The "GetReferenceNearestTargetFrameworkTask" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Users\Burak\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin" directory.
[info]: OmniSharp.MSBuild.ProjectManager
Update project: HotelContentFetcher
[fail]: OmniSharp.MSBuild.ProjectManager
Attemped to update project that is not loaded: c:\SwayPay-Marketing\ota-app-hotelbeds-content\FetcherTests\FetcherTests.csproj
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 7
- Comments: 56 (6 by maintainers)
@ErikSharp I found some workarounds that resolved the issue for me, more specifically:
MSBuild
directory thereUnfortunately, the issue doesn’t seem to be considered serious here as none of the maintainers has commented on this.
@akshita31 Will the root cause be fixed? After all, a workaround should not be considered as the solution. I do need the Build Tools for building other things like C++.
I realize that the origin poster was on Windows, but this problem occured for me on Linux and I couldn’t find a solution in any of the top threads. I’m not sure why, but the official mono-documentations says:
At best I feel like this is highly misleading as it does not install compile-dependencies. If you’re on a linux distribution, follow the instructions at this link to install the mono-devel package. At the time of writing this can be done using:
sudo apt install mono-devel
on Ubuntu 18.04. After that, you may need to install mono-complete as well, but this finally fixed the errors for me.@FranklinWhale @farzadmf - I had the same problem as you guys and the problem is that Omnisharp is choosing the MS Build instance for Visual Studio Build Tools 2017 as stated below:
Registered MSBuild instance: Visual Studio Build Tools 2017 15.8.28010.2041
As the exception says, the manifest file does exist, but if you look in it, it lists a relative path that is supposed to go to the SDK resolver. The path does not have the file listed nor some of the folders.
If you check the second MS Build instance listed, you will notice that the path does resolve to the correct file.
I couldn’t figure out how to force Omnisharp to choose a different MS Build instance, so the fix I came up with was just to uninstall Visual Studio.
@Moortiii Downloading and installing Mono from your link worked for me on MacOS Mojave 10.14.5. Thanks!
@akshita31, @rchande: Is there any update on this issue? I am unable to have VS Build Tools and VS code on the same machine now…
@akshita31 That works and I now know via OmniSharp/omnisharp-roslyn#1311 that:
@owensource @mjharper84 @FranklinWhale Can you try doing the above and checking if it works ?
+1 on this issue, and as the above has noted, uninstalling build-tools does not seem like a practical/tenable workaround.
Fixed once .sln file have been copied to the folder of .cproj item.
@farzadmf Thank you for listing the workarounds here.
I will close this issue for now. Feel free to reopen if the error repros again.