将项目转换为 PCL 和 .NET Core 会出现 CS0433 错误

Converting a project to PCL & .NET Core gives CS0433 Error

我已经采用了一个现有项目 https://github.com/cskardon/Neo4jClient/ 并尝试移植到 dotnet 核心,因为窥视者正在要求这样做。

到目前为止 - 我已经添加了一个 PCL 项目(uwp, dnxcore50, net46)和一个共享项目 - 将所有代码转移到共享项目,然后移动了 'Full' 东西(比如 Transaction.ScopeNeo4jClient.Full 项目。所以我(目前):

(在 Github 此处:https://github.com/cskardon/Neo4jClient/tree/Test-Portable

我的代码都在编译,我完全知道我缺少功能 - 但目前我很想知道我是否可以在通过 [=17 生成的控制台应用程序中使用它=] 在 VS Code 中。

所以我生成了一个 nuget 包并放入我的本地 nuget 商店(另外 - 如果你想自己尝试:https://www.myget.org/F/cskardon/api/v3/index.json)将它添加到我的 project.json,它看起来像:

{
  "version": "1.0.0-*",
  "description": "TestNeo4jClient Console Application",
  "authors": [ "" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",

  "compilationOptions": {
    "emitEntryPoint": true
  },

  "tooling": {
    "defaultNamespace": "TestNeo4jClient"
  },

  "dependencies": {
      "Neo4jClient" : "2.0.0-PortableAlpha00001"
  },

  "commands": {
    "TestNeo4jClient": "TestNeo4jClient"
  },

  "frameworks": {
    "dnx451": { },
    "dnxcore50": {
      "dependencies": {
        "Microsoft.CSharp": "4.0.1-beta-23516",
        "System.Collections": "4.0.11-beta-23516",
        "System.Console": "4.0.0-beta-23516",
        "System.Linq": "4.0.1-beta-23516",
        "System.Threading": "4.0.11-beta-23516"
      }
    }
  }
}

dnu restore - 一切正常

dnu build 给出了这些错误:

PCL 项目的 project.json 看起来像:

{
  "supports": {
    "net46.app": {},
    "uwp.10.0.app": {},
    "dnxcore50.app": {}
  },
  "dependencies": {
    "Microsoft.NETCore": "5.0.0",
    "Microsoft.NETCore.Portable.Compatibility": "1.0.0",
    "Newtonsoft.Json": "8.0.2",
    "NuSpec.ReferenceGenerator": "1.4.2",
    "System.Collections.NonGeneric": "4.0.0",
    "System.ComponentModel": "4.0.0",
    "System.ComponentModel.TypeConverter": "4.0.0",
    "System.Runtime.Serialization.Primitives": "4.0.10"
  },
  "frameworks": {
    "dotnet": {
      "imports": "portable-net452+win81"
    }
  }
}

我认为我弄错了 PCL project.json - 但我不知道怎么弄错了。

PS。 nuspec 文件如下所示:

  <dependencies>
    <group targetFramework="dotnet">
      <dependency id="Microsoft.CSharp" version="4.0.0" />
      <dependency id="Microsoft.VisualBasic" version="10.0.0" />
      <dependency id="Newtonsoft.Json" version="8.0.2" />
      <dependency id="System.Collections" version="4.0.10" />
      <dependency id="System.Collections.NonGeneric" version="4.0.0" />
      <dependency id="System.ComponentModel" version="4.0.0" />
      <dependency id="System.ComponentModel.Annotations" version="4.0.10" />
      <dependency id="System.ComponentModel.TypeConverter" version="4.0.0" />
      <dependency id="System.Diagnostics.Debug" version="4.0.10" />
      <dependency id="System.Dynamic.Runtime" version="4.0.10" />
      <dependency id="System.Globalization" version="4.0.10" />
      <dependency id="System.IO" version="4.0.10" />
      <dependency id="System.Linq" version="4.0.0" />
      <dependency id="System.Linq.Expressions" version="4.0.10" />
      <dependency id="System.Net.Http" version="4.0.0" />
      <dependency id="System.Net.Primitives" version="4.0.10" />
      <dependency id="System.Reflection" version="4.0.10" />
      <dependency id="System.Reflection.Extensions" version="4.0.0" />
      <dependency id="System.Reflection.TypeExtensions" version="4.0.0" />
      <dependency id="System.Resources.ResourceManager" version="4.0.0" />
      <dependency id="System.Runtime" version="4.0.20" />
      <dependency id="System.Runtime.Extensions" version="4.0.10" />
      <dependency id="System.Runtime.Serialization.Primitives" version="4.0.10" />
      <dependency id="System.Text.Encoding" version="4.0.10" />
      <dependency id="System.Text.RegularExpressions" version="4.0.10" />
      <dependency id="System.Threading" version="4.0.10" />
      <dependency id="System.Threading.Tasks" version="4.0.10" />
    </group>
  </dependencies>
</metadata>
<files>
  <file src="Neo4jClient.Full\bin\Release\Neo4jClient.dll" target="lib\net45" />
  <file src="Neo4jClient.Full\bin\Release\Neo4jClient.pdb" target="lib\net45" />
  <file src="Neo4jClient.Full\bin\Release\Neo4jClient.xml" target="lib\net45" />
  <file src="Neo4jClient\bin\Release\Neo4jClient.dll" target="lib\portable-net46+uwp10.0+dnxcore50" />
  <file src="Neo4jClient\bin\Release\Neo4jClient.pdb" target="lib\portable-net46+uwp10.0+dnxcore50" />
  <file src="Neo4jClient\bin\Release\Neo4jClient.xml" target="lib\portable-net46+uwp10.0+dnxcore50" />
  <file src="Neo4jClient\bin\Release\Neo4jClient.dll" target="lib\dotnet" />
  <file src="Neo4jClient\bin\Release\Neo4jClient.pdb" target="lib\dotnet" />
  <file src="Neo4jClient\bin\Release\Neo4jClient.xml" target="lib\dotnet" />
</files>

此时 DNU 工具已弃用,在 RC2 发布之前我不会花很多时间。 dotnet CLI 和 netstandard 有望清除很多此类混乱。