Skip to content

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

Open
@NikiPn

Description

@NikiPn

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:

<Project Sdk="Microsoft.NET.Sdk">
 
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8</TargetFramework>
    <Nullable>disable</Nullable>
  </PropertyGroup>
 
  <ItemGroup>
    <PackageReference Include="Microsoft.CodeAnalysis" Version="4.13.0-1.24517.9" />
    <PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.13.0-1.24517.9" />
  </ItemGroup>
 
  <ItemGroup>
    <COMReference Include="IWshRuntimeLibrary">
      <Guid>{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B}</Guid>
      <VersionMajor>1</VersionMajor>
      <VersionMinor>0</VersionMinor>
      <Lcid>0</Lcid>
      <WrapperTool>tlbimp</WrapperTool>
      <Isolated>False</Isolated>
      <EmbedInteropTypes>False</EmbedInteropTypes>
    </COMReference>
  </ItemGroup>
 
</Project>
  1. 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 may help you find a solution to the issue.

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions