在ASP.NET Core应用程序(RC2)中使用net451库

亨宁斯特

我正在尝试将我的ASP.NET 5 RC1项目升级到ASP.NET Core RC2项目。我遇到了一些问题,因为我使用的是尚不支持.NET Core的库,因此我必须在完整框架上运行。在RC1中,此方法运行良好,但我无法找出在RC2中实现此目标的正确方法。

我有一个可以还原软件包并正确构建的类库。我有一个引用类库的测试项目。当我尝试构建测试项目时,出现以下错误:

> dotnet build
Project TenantService (.NETFramework,Version=v4.5.1) was previously compiled. Skipping compilation.
Project TenantServiceTests (.NETCoreApp,Version=v1.0) will be compiled because expected outputs are missing
Compiling TenantServiceTests for .NETCoreApp,Version=v1.0
C:\projects\TenantService\test\TenantServiceTests\project.json(25,23): error NU1001: The dependency mscorlib could not be resolved.
C:\projects\TenantService\test\TenantServiceTests\project.json(9,31): error NU1001: The dependency mscorlib could not be resolved.
C:\projects\TenantService\test\TenantServiceTests\project.json(25,23): error NU1001: The dependency mscorlib could not be resolved.
C:\projects\TenantService\test\TenantServiceTests\project.json(9,31): error NU1001: The dependency mscorlib could not be resolved.
C:\projects\TenantService\test\TenantServiceTests\project.json(26,21): error NU1001: The dependency System could not be resolved.
C:\projects\TenantService\test\TenantServiceTests\project.json(9,31): error NU1001: The dependency System could not be resolved.
C:\projects\TenantService\test\TenantServiceTests\project.json(26,21): error NU1001: The dependency System could not be resolved.
C:\projects\TenantService\test\TenantServiceTests\project.json(9,31): error NU1001: The dependency System could not be resolved.
C:\projects\TenantService\test\TenantServiceTests\project.json(27,26): error NU1001: The dependency System.Core could not be resolved.
C:\projects\TenantService\test\TenantServiceTests\project.json(9,31): error NU1001: The dependency System.Core could not be resolved.
C:\projects\TenantService\test\TenantServiceTests\project.json(27,26): error NU1001: The dependency System.Core could not be resolved.
C:\projects\TenantService\test\TenantServiceTests\project.json(9,31): error NU1001: The dependency System.Core could not be resolved.
C:\projects\TenantService\test\TenantServiceTests\project.json(9,31): error NU1001: The dependency Microsoft.CSharp could not be resolved.

这两个项目的project.json文件如下所示:

src \ TenantService \ project.json

{
  "version": "1.0.0-*",

  "dependencies": {
    "NETStandard.Library": "1.5.0-rc2-24027",
    "Microsoft.Extensions.Options": "1.0.0-rc2-final",
    "Newtonsoft.Json": "8.0.4-beta1",
    "MongoDB.Driver": "2.2.4",
    "StackExchange.Redis": "1.1.603"
  },

  "frameworks": {
    "net451": {}
  }
}

test \ TenantServiceTests \ project.json

{
  "version": "1.0.0-*",
  "testrunner": "xunit",
  "description": "TenantServiceTests Class Library",
  "authors": [ "Henning" ],

  "dependencies": {
    "xunit": "2.1.0",
    "TenantService": "1.0.0-*",
    "dotnet-test-xunit": "1.0.0-rc2-build10015"
  },

  "frameworks": {
    "netcoreapp1.0": {
      "dependencies": {
        "Microsoft.NETCore.App": {
          "type": "platform",
          "version": "1.0.0-rc2-3002702"
        }
      },
      "imports": [
        "net451"
      ]
    }
  }
}

为了在我的应用程序中使用net451库,我应该如何正确设置呢?

大卫·派恩(David Pine)

依赖项mscorlib无法解析

昨天我遇到了同样的问题。问题是project.json测试项目的定位于netcoreapp1.0相反,您可以net451像测试服务一样框架作为目标,并且应该“可以正常工作”。

{
  "version": "1.0.0-*",
  "testrunner": "xunit",
  "description": "TenantServiceTests Class Library",
  "authors": [ "Henning" ],

  "dependencies": {
    "xunit": "2.1.0",
    "TenantService": "1.0.0-*",
    "dotnet-test-xunit": "1.0.0-rc2-build10015"
  },

  "frameworks": {
    "net451": { }
  }
}

有关此签出的更多详细信息,从ASP.NET 5 RC1迁移到ASP.NET Core另一个很棒的资源是corefx存储库的markdown文件,其中详细介绍了.NET Platform Standard

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

从ASP.NET Core MVC Web应用程序(RC2)引用完整框架库项目吗?

来自分类Dev

在ASP.NET MVC Core应用程序(RC2)中显示项目版本

来自分类Dev

ASP.NET Core 1 RC2 Web应用程序入口点

来自分类Dev

无法在IISExpress中启动ASP.NET Core RC2 Web应用程序

来自分类Dev

尝试从Web应用程序ASP.NET Core RC2引用.net core类库时出错

来自分类Dev

ASP.NET Core RC2和.NET 4.5.1应用程序之间的共享cookie身份验证

来自分类Dev

ASP.NET Core RC2和.NET 4.5.1应用程序之间的共享cookie身份验证

来自分类Dev

如何在ASP.NET Core RC2应用程序中手动重新加载IOptions

来自分类Dev

将rc2 asp.net核心应用程序发布到Azure

来自分类Dev

如何使ASP.NET Core RC2应用程序在具有较旧第三方依赖项的net46框架上构建

来自分类Dev

ASP.nET核心Web应用程序(.NET Core RC2)-为什么head标签中的项目显示在body标签中

来自分类Dev

在ASP.NET Core 1.0 RC2中使用RSS的正确方法

来自分类Dev

无法添加对.net core类库asp.net core rc2的引用

来自分类Dev

ASP Net Core 1 RC2 AccountController注入

来自分类Dev

ASP.NET Core rc2中的Cookie

来自分类Dev

ASP.NET Core RC2中的网址重写

来自分类Dev

是否发布了ASP.NET Core RC2?

来自分类Dev

ASP.NET Core RC2中的网址重写

来自分类Dev

在ASP.NET Core RC2中使用AddAuthentication时的模棱两可的调用

来自分类Dev

ASP.NET Core RC2种子数据库

来自分类Dev

ASP.NET Core RC2身份数据库架构迁移

来自分类Dev

来自Visual Studio Team Services的未经授权的nuget程序包,使用asp.net core rc2

来自分类Dev

如何启动不监听本地主机的ASP.NET Core 1.0 RC2应用

来自分类Dev

如何启动不监听本地主机的ASP.NET Core 1.0 RC2应用

来自分类Dev

如何在ASP.NET Core 1.0 RC2中加载程序集

来自分类Dev

在asp.net核心RC2中使用swagger

来自分类Dev

.NET Core RC2 applicationhost.config与ASP.NET .NET 4.6不兼容?

来自分类Dev

使用IIS从Asp Net Core RC2网站访问本地目录

来自分类Dev

使用ASP.NET Core RC2 404(而不是403)进行承载身份验证

Related 相关文章

  1. 1

    从ASP.NET Core MVC Web应用程序(RC2)引用完整框架库项目吗?

  2. 2

    在ASP.NET MVC Core应用程序(RC2)中显示项目版本

  3. 3

    ASP.NET Core 1 RC2 Web应用程序入口点

  4. 4

    无法在IISExpress中启动ASP.NET Core RC2 Web应用程序

  5. 5

    尝试从Web应用程序ASP.NET Core RC2引用.net core类库时出错

  6. 6

    ASP.NET Core RC2和.NET 4.5.1应用程序之间的共享cookie身份验证

  7. 7

    ASP.NET Core RC2和.NET 4.5.1应用程序之间的共享cookie身份验证

  8. 8

    如何在ASP.NET Core RC2应用程序中手动重新加载IOptions

  9. 9

    将rc2 asp.net核心应用程序发布到Azure

  10. 10

    如何使ASP.NET Core RC2应用程序在具有较旧第三方依赖项的net46框架上构建

  11. 11

    ASP.nET核心Web应用程序(.NET Core RC2)-为什么head标签中的项目显示在body标签中

  12. 12

    在ASP.NET Core 1.0 RC2中使用RSS的正确方法

  13. 13

    无法添加对.net core类库asp.net core rc2的引用

  14. 14

    ASP Net Core 1 RC2 AccountController注入

  15. 15

    ASP.NET Core rc2中的Cookie

  16. 16

    ASP.NET Core RC2中的网址重写

  17. 17

    是否发布了ASP.NET Core RC2?

  18. 18

    ASP.NET Core RC2中的网址重写

  19. 19

    在ASP.NET Core RC2中使用AddAuthentication时的模棱两可的调用

  20. 20

    ASP.NET Core RC2种子数据库

  21. 21

    ASP.NET Core RC2身份数据库架构迁移

  22. 22

    来自Visual Studio Team Services的未经授权的nuget程序包,使用asp.net core rc2

  23. 23

    如何启动不监听本地主机的ASP.NET Core 1.0 RC2应用

  24. 24

    如何启动不监听本地主机的ASP.NET Core 1.0 RC2应用

  25. 25

    如何在ASP.NET Core 1.0 RC2中加载程序集

  26. 26

    在asp.net核心RC2中使用swagger

  27. 27

    .NET Core RC2 applicationhost.config与ASP.NET .NET 4.6不兼容?

  28. 28

    使用IIS从Asp Net Core RC2网站访问本地目录

  29. 29

    使用ASP.NET Core RC2 404(而不是403)进行承载身份验证

热门标签

归档