OmniSharp 在 Visual Studio 代码中使用 COMReferences 加载项目时出错

OmniSharp error loading projects with COMReferences in Visual Studio Code

在新 Visual Studio 代码中加载项目时遇到问题,这些代码在 Visual Studio 2013 中运行良好。我能够加载在 Visual Studio 代码中没有 COMReferences 的其他项目。使用 Windows 7 企业。

.csproj 文件中的相关片段:

<ItemGroup>
    <COMReference Include="DTOLib2">
      <Guid>{DBE2B0CE-6BE9-48FE-8300-6ABE0DB9692B}</Guid>
      <VersionMajor>1</VersionMajor>
      <VersionMinor>0</VersionMinor>
      <Lcid>0</Lcid>
      <WrapperTool>tlbimp</WrapperTool>
      <Isolated>False</Isolated>
      <EmbedInteropTypes>True</EmbedInteropTypes>
    </COMReference>
  </ItemGroup>

来自 OmniSharp 日志的相关片段:

[ERROR:OmniSharp.MSBuild.MSBuildProjectSystem] The "ResolveComReference" task could not be instantiated from "Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". The domain manager specified by the host could not be instantiated.

[ERROR:OmniSharp.MSBuild.MSBuildProjectSystem] The "ResolveComReference" task has been declared or used incorrectly, or failed during construction. Check the spelling of the task name and the assembly name.

OmniSharp 中对 MSBuild 的支持不如我们希望的那样好。这里有一个总结错误:https://github.com/OmniSharp/omnisharp-roslyn/issues/202

更新到 Visual Studio 代码 0.7.0 解决了这个问题:)