.net - 如何修复 "the type or namespace name "系统“无法找到您是否缺少指令或程序集引用 (CS0246)”

标签 .net .net-core

我正在尝试在我的 visual studio 代码中安装 .net core sdk。在使用 dotnet restore 命令安装 .net core sdk 后,我遇到了这样的问题。我该如何解决这个问题?

using System;
namespace BRT.BLL.Model
{
    /// <summary>
    /// Generic response model
    /// </summary>
    public class ApiResponse
    {
        //result status codes, 200,400..
        public ApiResponse(int statusCode, object result, string type,
            string message, bool isSuccess)
        {
            this.StatusCode = statusCode;
            this.Result = result;
            this.Type = type;
            this.Message = message;
            this.IsSuccess = isSuccess;

        }
        public int StatusCode { get; set; }
        //dynamic data result 
        public object Result { get; set; }
        //type of the dynamic data
        public string Type { get; set; }
        //custome message
        public string Message { get; set; }
        //if the request is successful or not
        public bool IsSuccess { get; set; }
}

predefined type "system.Int32"is not defined or imported等相关问题

最佳答案

我经常在新项目中遇到这种情况。一个简单的清理、恢复 nuget 包和重建通常可以很好地修复它。如果您最近安装了新版本的 Net Core,它也有助于重新启动您的 PC。

关于.net - 如何修复 "the type or namespace name "系统“无法找到您是否缺少指令或程序集引用 (CS0246)”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57473140/

相关文章:

c# - 使用数组属性绑定(bind)模型以在 ASP.NET Core MVC 中形成

c# - 组件中的调用方法

asp.net-mvc - .NET Core 2 Web API : [FromBody] nested object was not binded

asp.net-core - 如何在 Swagger UI 中使用自动变量?

c# - 将 native DLL 路径添加到托管控制台应用程序

c# - ViewBag 不保存状态

c# - 使用数组语法初始化我的类

asp.net-core - 确定需要哪个 .NET Core 运行时

.net - 如何在 LINQPad 中添加对程序集的引用以访问自定义类型?

c# - System.NotSupportedException - 无法比较“System.Linq.IQueryable”类型的元素