如何在project.json中引用特定版本的NetStandard? [英] How to reference a specific version of NetStandard in project.json?

查看:201
本文介绍了如何在project.json中引用特定版本的NetStandard?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力找出如何强制npm( Nuget软件包管理器)解析NetStandard1.X平台的特定版本.

I am struggling to figure out how to force the npm (Nuget Package Manager) to resolve a specific version of the NetStandard1.X platform.

我正在尝试使用 Serilog ,但它支持的.NetStandard版本是v1.3. .是否有任何方法可以通过某些命令或开关或选项在project.json文件中强制这种行为.

I am trying to use Serilog but the version of .NetStandard it supports is v1.3. Is there any way to force this behavior in the project.json file via some command or switch or option.

        {
  "version": "1.0.0-*",

  "dependencies": {
    "NETStandard.Library": "1.6.0",
    "Serilog": "2.2.1"
  },

  "frameworks": {
    "netstandard1.3": {
      "imports": "dnxcore50",
      "dependencies": {
      }
    }
  }
}

指定v1.3 时,您将得到 v1.6 .当然必须有一种方法吗?我正在尝试升级使用log4net的旧.net框架4.6类库,而我在这里苦苦学习基础知识.

When you specify v1.3, you end up with v1.6. Surely there must be a way of doing this? I am trying to upgrade an old .net framework 4.6 class library that was using log4net and I am struggling with the basics here.

错误转储:

Error Dump:

Package Serilog 2.2.1 is not compatible with netstandard1.6 (.NETStandard,Version=v1.6). Package Serilog 2.2.1 supports:
  - net45 (.NETFramework,Version=v4.5)
  - net46 (.NETFramework,Version=v4.6)
  - netstandard1.0 (.NETStandard,Version=v1.0)
  - netstandard1.3 (.NETStandard,Version=v1.3)
One or more packages are incompatible with .NETStandard,Version=v1.6.

DotNet核心版本信息:

DotNet Core Version Info:

产品信息:

版本:1.0.0-preview2-003131

Version: 1.0.0-preview2-003131

提交SHA-1哈希:635cf40e58

Commit SHA-1 hash: 635cf40e58

推荐答案

您的project.json可以在我的计算机上正确还原,因此我认为软件包/版本有问题.

Your project.json restores on my machine correctly, so I would guess there is something wrong with packages/versioning.

请尝试更改Serilog依赖版本:

"Serilog": "2.3.0-dev-00711"

或者如您在我们的聊天中建议的那样,将礼仪移到framework标签中:

Or as you suggested yourself during our chat, move the decency into framework tag:

"frameworks": { 
    "netstandard1.6": { 
        "imports": "dotnet5.6", 
        "dependencies": { 
            "Serilog": "2.3.0-dev-00711" 
        } 
    } 
} 

这篇关于如何在project.json中引用特定版本的NetStandard?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆