-
Notifications
You must be signed in to change notification settings - Fork 675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load C# project with a COM reference fails: "ResolveComReference" task could not be instantiated... #3766
Comments
Thanks @Antelope-IT - is this project sharable? Unfortunately, this is close to impossible to understand without the project to work with. That said, there are some problems with the OmniSharp project system that could be leading to it just failing to load this task. |
Unfortunately the original project isn't sharable, but I have managed to reproduce it with a bare minimum project - the code compiles in VS 2019 but simply loading the folder in VS Code results in the OmniSharp log below. I doubt the code runs (I haven't tried it) - its just enough to get the error to show. `Starting OmniSharp server at 13/05/2020, 08:16:12 OmniSharp server started. Starting OmniSharp on Windows 6.2.9200.0 (x64) Attempted to update project that is not loaded: c:\tmp\OmnisharpTest\OmniSharpComWrapperTest\ComWrapper\ComWrapper.csproj Hope this helps, if you need anything more then please come back to me. |
same issue here! |
same! |
what i notice about this is that |
The version of MSBuild is locked to 15.1.0.0, however the FileVersion represent the true version of the assembly. (See comment) |
Thanks for the update. I can reproduce this with the project you added. This will need more investigation, sadly. |
Here's another sln that recreates the issue: https://github.com/AsoboStudio/FlightSim-glTF-exporter/tree/master/3ds%20Max |
I got the same issue. |
same here. I think it's more a microsoft problem (in the targets file) |
same. |
got same issue, is there any update on this |
same here, i reference a IWshRuntimeLibrary caused this issue |
https://stackoverflow.com/a/44120849 says:
OmniSharp is built with the .NET Core SDK, right? |
Same issue here. Any fix? |
Just to help with the diagnostcs: here is a repository where it's happening: Bigous/MarketMonitor. But I think the problem is the Microsoft.Build.Tasks.Core can't refers/open the COM reference. Could you fallback to the |
I have the same problem:
And stranger still, it breaks the UI of VSCode. Once Omnisharp crash, I lose the folding icons in the code editor part. |
Same issue here trying to add the following COMReference to Excel Interop.
Without this reference Omnisharp is happy. |
Same here suffering from this connecting remotely to my virtual machine Windows 10 on host Linux Mint |
Same problem. Still no fix after 3 years ? :( |
Still waiting for a solution...😢 |
Same 😢 |
Closing as ComReferences are not supported on modern .NET. See dotnet/msbuild#3986 (comment) |
Issue Description
Omnisharp fails to load a project with a COM reference "ResolveComReference" task could not be instantiated...
Steps to Reproduce
I don't know the precise steps to reproduce but the project is an electronjs application with C# dependencies which although part of the project are actually managed through VS with a VS solution file. The C# components are a mix of .net core, .net standard 2 and full framework 4.7.2 projects. All the projects load except one. The problematic project was added recently it has a COM reference to the Windows Scripting Host library which I suspect is the trigger for the issue (the presence of the com reference not the specific library) The whole project builds through a combination of MSBuild and Electron-Build - this succeeds ok, and the VS solution file also builds the C# components separately without issue.
Expected Behavior
All C# projects should be loaded without issue.
I'm not sure why its trying to instantiate the COM task with version 15.1 of the Microsoft.Build.Tasks.Core when the version in the registered MS Build instance would appear to be v 16.5 AFAIKS - but then I could be trying to compare the wrong version numbers.
Actual Behavior
The C# project with a Com reference fails with an error : The "ResolveComReference" task could not be instantiated from "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Could not load file or assembly 'Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Logs
OmniSharp log
OmniSharp server started.
Path: .vscode\extensions\ms-dotnettools.csharp-1.21.18.omnisharp\1.35.2-beta.8\OmniSharp.exe
PID: 18824
Starting OmniSharp on Windows 6.2.9200.0 (x64)
info: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 4 MSBuild instance(s)
1: Visual Studio Enterprise 2019 16.5.30011.22 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin"
2: Visual Studio Build Tools 2017 15.9.28307.1033 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"
3: Visual Studio Enterprise 2017 15.9.28307.812 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin"
4: StandAlone 16.4 - "c:\Users<Redacted>.vscode\extensions\ms-dotnettools.csharp-1.21.18.omnisharp\1.35.2-beta.8.msbuild\Current\Bin"
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: Visual Studio Enterprise 2019 16.5.30011.22 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin"
Loading project: .csproj
fail: OmniSharp.MSBuild.ProjectLoader
The "ResolveComReference" task could not be instantiated from "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Could not load file or assembly 'Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
fail: OmniSharp.MSBuild.ProjectLoader
The "ResolveComReference" task has been declared or used incorrectly, or failed during construction. Check the spelling of the task name and the assembly name.
[warn]: OmniSharp.MSBuild.ProjectManager
Failed to load project file '.csproj'.
c:<Redacted>.csproj
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2701,5): Error: The "ResolveComReference" task could not be instantiated from "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Could not load file or assembly 'Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2701,5): Error: The "ResolveComReference" task has been declared or used incorrectly, or failed during construction. Check the spelling of the task name and the assembly name.
Attempted to update project that is not loaded: .csproj
C# log
Environment information
VSCode version: 1.45.0
C# Extension: 1.21.18
Dotnet Information
.NET Core SDK (reflecting any global.json): Version: 3.1.201 Commit: b1768b4ae7Runtime Environment:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.201\
Host (useful for support):
Version: 3.1.3
Commit: 4a9f85e9f8
.NET Core SDKs installed:
1.1.13 [C:\Program Files\dotnet\sdk]
1.1.14 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.505 [C:\Program Files\dotnet\sdk]
2.1.508 [C:\Program Files\dotnet\sdk]
2.1.602 [C:\Program Files\dotnet\sdk]
2.1.604 [C:\Program Files\dotnet\sdk]
2.1.700 [C:\Program Files\dotnet\sdk]
2.1.701 [C:\Program Files\dotnet\sdk]
2.1.801 [C:\Program Files\dotnet\sdk]
2.1.802 [C:\Program Files\dotnet\sdk]
2.2.105 [C:\Program Files\dotnet\sdk]
3.1.201 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Visual Studio Code Extensions
The text was updated successfully, but these errors were encountered: