ResolveComReference task could not be loaded

后端 未结 1 1043
野的像风
野的像风 2021-02-15 15:32

Win7, VS2017, ASP Net core app, target framework is 4.6.

When I try to build my project with CLI (it is needed before dotnet commands calling) the error occurs:

相关标签:
1条回答
  • 2021-02-15 16:05

    COM references are not supported by the .net core version of MSBuild which is what the .NET CLI uses. For those references to work, you have to build your project using msbuild directly. Using the Developer Command Prompt for Visual Studio 2017 you should be able to perform the build using commands like:

    msbuild /t:Restore
    msbuild /t:Build /p:Configuration=Release
    msbuild /t:Publish /p:Configuration=Release
    

    (you can also add /m to enable parallel builds).

    This reference is also unsupported when running CLI tools that use these project files since they also rely on the .NET Core version of MSBuild.

    However, there is a workaround that will enable CLI tools to be able to use the project, but it will not allow them to fully build using the .NET Cli. Add the following Condition attribute to your ComReference items to "hide" the COM reference when building with the .NET Core version of MSBuild:

    <COMReference Include="FooBar" Condition="'$(MSBuildRuntimeType)' != 'Core'">
      <Guid>{some-guid}</Guid>
      <!-- a lot more metadata elements -->
    </COMReference>
    
    0 讨论(0)
提交回复
热议问题