.NET Core error during assembly: Microsoft.Build.Tasks.ResolveComReference MSB4062 error

I am working on a .net web web application (net461 targeting). The application must reference the COM DLL.

I added a COM link and the application is still running on my dev machine. However, on the build server it cannot build with this error:

C: \ Program Files (x86) \ dotnet \ sdk \ 2.0.0 \ Microsoft.Common.CurrentVersion.targets (2604.5): error MSB4062: task "Microsoft.Build.Tasks.ResolveComReference" could not be loaded from the Microsoft assembly .Build.Tasks.Core

After a short search, it seems like this is a rather unusual mistake. Does anyone know what an error is and / or how to fix it?


UPDATE: It seems that CLET with dotnet does not support COM references. Visual Studio uses msbuild directly behind the curtains, but on the build server I used the dotnet CLI commands.

WORKAROUND:

  • Link to COM DLL and rebuild. Visual Studio will generate interop dll. It will be called as Interop.MyComDLL.dll. It is located in the assembly output directory.
  • Copy the generated DLL converter somewhere in the application (I just used the / dlls folder at the root application level).
  • Remove the link to COM-dll.
  • Add direct link (Dependencies> Add link ...> Browse in Visual Studio) to the interop library
+4
source share
1 answer

, , , ,

dotnet.exe build Solution.sln --configuration Release --no-incremental

VS msbuild, -.

0

Source: https://habr.com/ru/post/1688549/


All Articles