dotnet / dotnet/roslyn

Msbuild failed when processing the file. Message: The task "ResolveComReference" is not supported on the .NET Core version of MSBuild

Open
#75,558 0 comments 0 reactions 1 assignee Claimed by @JoeRobich View on GitHub
Area-IDE IDE-MSBuildWorkspace
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

**Version Used**:
4.13.0-1.24517.9

**Steps to Reproduce**:

1. Create a console app and add the 'COMReference' item and packages 'Microsoft.CodeAnalysis' and 'Microsoft.CodeAnalysis.Workspaces.MSBuild' (version 4.13.0-1.24517.9).

The project file will be as follows:
```



Exe
net8
disable









{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B}
1
0
0
tlbimp
False
False


```

2. Add this code fragment to the 'Main' method:
```
var workspace = MSBuildWorkspace.Create();
_ = workspace.OpenSolutionAsync("D:\\ProjectContainingCOMReference.sln").Result;
```
**Expected Behavior**:
Should work without errors in workspace.

**Actual Behavior**:
After executing the 'OpenSolutionAsync' method in 'workspace.Diagnostics', the following error message appears: "Msbuild failed when processing the file 'D:\MyProject.csproj' with message: The task "ResolveComReference" is not supported on the .NET Core version of MSBuild. Please use the .NET Framework version of MSBuild. See https://aka.ms/msbuild/MSB4803 for further details."

**Note**
The issue may arise because in the project from the example, Roslyn uses BuildHost for .NET Core instead of BuildHost for .NET Framework. [This file](https://github.com/dotnet/roslyn/blob/main/src/Workspaces/Core/MSBuild/MSBuild/BuildHostProcessManager.cs) may help you find a solution to the issue.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.