【问题标题】:Cannot Call My Class and method in .Net Core Class Library From Asp.Net Core app无法从 Asp.Net Core 应用程序调用 .Net Core 类库中的我的类和方法
【发布时间】:2016-11-05 02:49:11
【问题描述】:

我之前在herestackoverflow for example this 中搜索过。 对于依赖项已解决,不会出错。但是当我想在没有显示在 Intellisense 中的类(在 .Net 类库上)中调用我的方法时。我无法调用命名空间引用。

我检查并比较了我的project.json 与我的谷歌搜索结果并降级netstandard library to 1.4 and 1.3,仍然无法调用我的方法...卸载我的 resharper 无济于事,仍然出现错误。

我正在使用 Vs.2015 更新 3。

.Netcore v.1.0.1

这是我在 .Net Core 类库中的project.json,项目名称为“DataContextCore”

{
  "version": "1.0.0-1",

  "dependencies": {
    "NETStandard.Library": "1.5.0-rc2-24027"
  },

  "frameworks": {
    "netstandard1.4": {
      "imports": "dnxcore50"
    }
  }
}

这是我在 Asp.Net Core 中的 project.json

  "dependencies": {
   ....other package library
    "DataContextCore": {"target" : "project", "version" : "1.0.0-1"}
  },

有谁知道为什么会这样。或者或者确实 asp.net core 直到现在还不稳定。 我对 asp.net 核心及其所有配置感到非常沮丧,看起来像傻瓜或 asp.net 核心不稳定..我希望微软的人能回答这个问题。

【问题讨论】:

  • 你遇到了什么错误?
  • 我没有错误......只是无法调用其他 .NET Core 类库中的所有函数......当恢复依赖关系解决时,没有出错......就是这样。
  • 现在我尝试卸载或修复我的 Visual Studio,再次安装时可能会得到更新....感谢您的宝贵时间

标签: asp.net-core asp.net-core-mvc .net-core


【解决方案1】:

我会删除那个过时的 rc2 引用,像这样更新它:

"NETStandard.Library": "1.6.0-*"

"netstandard1.6": {
        "imports": "dnxcore50"
    }

【讨论】:

  • 抱歉,更新...我按照您的建议进行了更新以删除,但仍然无法正常工作。
  • 现在我尝试卸载或修复我的 Visual Studio,再次安装时可能会得到更新....感谢您的宝贵时间
猜你喜欢
  • 1970-01-01
  • 2018-10-16
  • 2020-10-27
  • 2016-09-15
  • 1970-01-01
  • 2016-10-17
  • 2017-07-18
  • 1970-01-01
  • 2023-03-19
相关资源
最近更新 更多