IEnumerable的<>新的NuGet类库项目

编程入门 行业动态 更新时间:2024-10-13 12:23:56
本文介绍了IEnumerable的<>新的NuGet类库项目 - 在未引用的程序定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用VS2015的社区,我安装了.NET 4.6.01040我也跟着的这些说明安装ASP.NET 5。

I'm using VS2015 Community, I have .NET 4.6.01040 installed and I followed these instructions to install ASP.NET 5.

我要开始MVC5一个站点迁移到MVC6所有附带的其他更新,所以我就开始与持有我的数据模型实体类库项目。这是我的 project.json 文件的样子:

I want to start migrating a site from MVC5 to MVC6 all the other updates that came with it, so I started with the Entity Class library project that holds my Data model. This is how my project.json file looks like:

{ "version": "1.0.0-*", "description": "test.Entities Class Library", "authors": [ "me" ], "tags": [ "" ], "projectUrl": "", "licenseUrl": "", "frameworks": { "net461": { "dependencies": { "System.Runtime": "4.0.0.0" } }, "dotnet5.4": { "dependencies": { "Microsoft.CSharp": "4.0.1-beta-23516", "System.Runtime": "4.0.21-beta-23516", "System.Linq": "4.0.1-beta-23516" "System.Collections": "4.0.11-beta-23516", "System.Threading": "4.0.11-beta-23516" } } }, "dependencies": { "EntityFramework.Core": "7.0.0-rc1-final", } }

我从变化框架类型net451到net461,因为我认为这是问题,我也试图引用添加到依赖,但没有运气...

I changed the framework type from "net451" to "net461" cause I thought that that was the problem, and I also tried to add the reference to the dependencies, but no luck...

该错误是发生在这里:

[NotMapped] public decimal TotalOrders => Math.Round(Orders.Where(x => x.Code.StartsWith("5") .Sum(x => x.Amount),MidpointRounding.AwayFromZero);

完整的错误是:

CS0012 The type 'IEnumerable<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. test.Entity..NET Framework 4.6

如何使这项工作与新的项目类型的任何想法?

Any idea on how to make this work with the new project types?

推荐答案

net461 目标框架名(TFM)再presents完整的桌面.NET Framework和若你想从这个框架中引用 System.Runtime ,你需要移动System.Runtime:4.0.0.0进入 frameworkAssemblies 节点。

net461 target framework name (TFM) represents the full desktop .NET Framework and if you want to reference System.Runtime from this framework, you need to move the "System.Runtime": "4.0.0.0" entry to frameworkAssembliesnode.

更多推荐

IEnumerable的&LT;&GT;新的NuGet类库项目

本文发布于:2023-11-09 04:23:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1571393.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:类库   项目   LT   IEnumerable   NuGet

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!