Handle netstandard1.6 with xUnit

前端 未结 5 1778
轮回少年
轮回少年 2021-01-18 07:29

I am looking to use a test framework for a netstandard1.6 library. I tried to follow and edit Getting started with xUnit.net (.NET Core / ASP.NET Core) without success. Foll

5条回答
  •  余生分开走
    2021-01-18 08:10

    The .NET CLI tool (dotnet) support creating a test project:

    testproj $ dotnet new -t xunittest
    Created new C# project in /home/bartonjs/dotnet/testproj.
    testproj $ cat project.json
    

    Produces:

    {
      "version": "1.0.0-*",
      "buildOptions": {
        "debugType": "portable"
      },
      "dependencies": {
        "System.Runtime.Serialization.Primitives": "4.1.1",
        "xunit": "2.1.0",
        "dotnet-test-xunit": "1.0.0-rc2-192208-24"
      },
      "testRunner": "xunit",
      "frameworks": {
        "netcoreapp1.0": {
          "dependencies": {
            "Microsoft.NETCore.App": {
              "type": "platform",
              "version": "1.0.0"
            }
          },
          "imports": [
            "dotnet5.4",
            "portable-net451+win8"
          ]
        }
      }
    }
    

    Those versions might better lead to success.

提交回复
热议问题