首页 > 解决方案 > 对类型 system.icloneable' 的引用声称它在 system.runtime 中定义但无法找到

问题描述

我在“新 SqlConnection”行上收到此错误。

.netcore 2 Web 应用程序 这是包含在具有 nuget 包的 .netstandard 类库中的代码:

系统运行时 4.3.1

系统配置

我真的不知道这里有什么问题,这是我的第一个 .netcore 应用程序,所以我可能在这里缺少一些业余爱好者

 using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Text;
using EP.Data.Helper;
public class BaseDALayer
{
    private void ExecuteStoredProcedure()
    {
        try
        {
            string connectionString = ConfigurationHelper.GetConnectionString();
            using (var connection = new SqlConnection(connectionString))
            {

            }
        }
        catch (Exception ex)
        {
            LogException(ex);
        }
    }

    private void LogException(Exception ex)
    {

    }
}

标签: c#.net

解决方案


将 MySql.Data nuget 包更新到最新版本(在我的情况下为 v8.0.23)解决了该问题


推荐阅读