![](/img/trans.png)
[英]How to change target framework of a .net core project from netstandard2.1 to netcoreapp3.1 in VS Code
[英]TableAttribute is missing when change target from netcoreapp3.0 to netstandard2.1
我想我應該移動我的 class 庫以使用 .net 標准 2.1。
表屬性不在 .net 標准 2.1 中嗎?
using PWDRS.Core.Entities.Base;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PWDRS.Core.Entities
{
[Table("ReportType", Schema = "RF")]
public class RfReportType : EntityBase
{
public RfReportType()
{
}
命名空間“System.ComponentModel”中不存在類型或命名空間名稱“DataAnnotations”(您是否缺少程序集引用?)
找不到類型或命名空間名稱“TableAttribute”(您是否缺少 using 指令或程序集引用?)
找不到類型或命名空間名稱“表”(您是否缺少 using 指令或程序集引用?)
找不到類型或命名空間名稱“架構”(您是否缺少 using 指令或程序集引用?)
TableAttribute
屬於System.ComponentModel.Annotations程序集,它不是 .NET 標准的一部分。 而且似乎沒有計划包含它,請參閱此 github 問題
您需要將其安裝為 package
Install-Package System.ComponentModel.Annotations -Version 4.6.0
或使用Microsoft.EntityFrameworkCore package ,其中包括System.ComponentModel.Annotations ,如果您需要更多
Install-Package Microsoft.EntityFrameworkCore -Version 3.0.1
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.