小编Saq*_*dia的帖子

Moq.netcore失败.Net Core RC2

所以我有一个使用Moq的.Net RC1解决方案,我已经升级到RC2,我发现Moq.netcore是为了在新平台上运行而创建的.

我在我的NuGet.config中添加了aspnet-contrib

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="contrib" value="https://www.myget.org/F/aspnet-contrib/api/v3/index.json" />
    <add key="NuGet" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
</configuration>
Run Code Online (Sandbox Code Playgroud)

我已将moq.netcore添加到我的project.json文件中.

"dependencies": {
  "Microsoft.NETCore.App": {
    "version": "1.0.0-rc2-*",
    "type": "platform"
  },
  "dotnet-test-xunit": "1.0.0-rc2-173361-36",
  "moq.netcore": "4.4.0-beta8",
  "xunit": "2.1.0"
},

"testRunner": "xunit",

"frameworks": {
  "netcoreapp1.0": {
    "imports": [
      "dotnet5.6",
      "portable-net451+win8"
    ]
  }
}
Run Code Online (Sandbox Code Playgroud)

基本上我遵循Cli测试抽象单元测试,并在实例化Mock对象时出现以下错误:

System.IO.FileNotFoundException : 
  Could not load file or assembly 'System.Diagnostics.TraceSource, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

  Stack Trace:
       at Castle.DynamicProxy.Generators.MethodWithInvocationGenerator.BuildProxiedMethodBody(MethodEmitter emitter, …
Run Code Online (Sandbox Code Playgroud)

.net c# moq asp.net-core .net-core-rc2

15
推荐指数
1
解决办法
5301
查看次数

标签 统计

.net ×1

.net-core-rc2 ×1

asp.net-core ×1

c# ×1

moq ×1