0

When I started my new project (.net 5.0), I used to script the build using the dotnet CLI: dotnet build

Everything worked well until I recently had to add a COM reference to the project:

COM Reference

(I am not very used to the way this COM stuff works, so forgive me if I misunderstand something and do not hesitate to provide detailed information in your answers)

This addition causes the build with the dotnet CLI to fail:

MSB4803: The task “ResolveComReference” is not supported on the .NET Core version of MSBuild. Please use the .NET Framework version of MSBuild.

I don't really understand this error since I am using .NET 5 (I checked with dotnet --version) and not .NET Core but I guess it's just a remainder from the previous versions of ".NET".

Since the build from Visual Studio works fine, and according to the error message, I switched my automated scripts to use MSBuild and everything works fine again.

But I was wondering if it was still possible to use the dotnet CLI?

I tried to used the msbuild argument of the dotnet CLI, but with the same result:

ResolveComReference

fharreau
  • 2,105
  • 1
  • 23
  • 46
  • .NET 5 is actually .NET Core 5. .NET 5 supports adding COM objects, but it's not using ResolveComReference. This ResolveComReference should be removed as it's not supported as said. Just add a COM object using Visual Studio and you'll see it will add something like ` etc.` instead which will compile fine. – Simon Mourier Mar 17 '21 at 18:18
  • I already added the COMReference to the project. And as I said, I already switched my automated script to use MSBuild. My question is not how to do this. It is: **Is it still possible to use the `dotnet CLI`?** With a hack or something. For example, I tried to use the msbuild argument of the dotnet CLI. But it looks like it is not calling the expected msbuild ... – fharreau Mar 17 '21 at 18:49
  • Well I guess it does. Even if I don't get the point of the **MSBuild** argument in the `dotnet CLI`... – fharreau Mar 17 '21 at 18:57

0 Answers0