Can ASP.NET vNext use non-vNext references?

后端 未结 2 1362
生来不讨喜
生来不讨喜 2021-02-05 02:42

So I have a ASP .NET vNext project in VS 14 CTP. I am targeting .NET Framework 4.5.1. I added a reference to a NuGet package, which does not have a build specific for vNext.

2条回答
  •  一向
    一向 (楼主)
    2021-02-05 03:22

    If you have both k10 and net451 frameworks listed in project.json, VS 14 by default builds project against both frameworks. In such case if any of the assemblies are not built for k10 framework, build fails with package not found error. So net 451 packages should specifically be added in net451 section of project.json. I am just pasting an example project.json where Microsoft.Bcl package is listed in net451 section

    {
    "dependencies": {
        "Microsoft.AspNet.Server.IIS": "1.0.0-*",
        "Microsoft.AspNet.Mvc": "6.0.0-*"
        
    },
    "configurations": {
        "net451": {
            "dependencies": {
                "Microsoft.Bcl": "1.1.9"
                }        
      }
     }
    }
    

提交回复
热议问题