【问题标题】:Microsoft Enterprise Library not recognize in Azure DevOpsAzure DevOps 中无法识别 Microsoft 企业库
【发布时间】:2019-11-02 11:51:29
【问题描述】:

我有一个网络应用程序,它使用asp.net mvc 和使用Enterprise Library 的数据访问。项目运行良好。但我已经设置了VSTS DevOps。然后它构建它并显示错误

错误 CS0234:命名空间“Microsoft.Practices.EnterpriseLibrary”中不存在类型或命名空间名称“Data”(您是否缺少程序集引用?)

我的代码

using NewsHub.Domain;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace NewsHub.Data
{
    public class FeedbackRepository : IFeedbackRepository
    {
        Database db;
        DbCommand cmd;
        DbCommand cxd;
        DbConnection con;
        DbTransaction transaction;

        public FeedbackRepository()
        {
            DatabaseProviderFactory factory = new DatabaseProviderFactory();
            db = factory.Create("NewsHubConString");
            con = db.CreateConnection();
        }

        public List<FeedbackDTO> GetAllFeedbacks()
        {
            List<FeedbackDTO> _feedback = new List<FeedbackDTO>();
            try
            {
                con.Open();    
                // Some code goes here    
            }
            catch (Exception ex)
            {    
                throw;
            }

            return _feedback;
        }
    }
}

【问题讨论】:

  • 这不能解决您的问题,但该库不再处于开发阶段。我会避免它。你需要它做什么?
  • 如果 dll 已下载,您能否检查 nuget 还原日志?
  • @WilliamXifaras 我已经使用 Enerprise 库连接了我的数据库。那么如何避免呢?
  • @ShaykiAbramczyk 日志在哪里?
  • 在构建摘要中

标签: c# asp.net asp.net-mvc azure azure-devops


【解决方案1】:

Microsoft Enterprise Library 在 Azure DevOps 中无法识别

根据您在评论中提供的 nuget 还原日志:

Restoring NuGet package bootstrap.3.0.0.
Restoring NuGet package Antlr.3.4.1.9004.
Restoring NuGet package jQuery.1.10.2.
Restoring NuGet package AutoMapper.8.0.0.
Restoring NuGet package jQuery.Validation.1.11.1.
Restoring NuGet package Microsoft.ApplicationInsights.2.2.0.
Restoring NuGet package Microsoft.ApplicationInsights.Agent.Intercept.2.0.6.
Restoring NuGet package Microsoft.ApplicationInsights.DependencyCollector.2.2.0.
Restoring NuGet package Microsoft.ApplicationInsights.PerfCounterCollector.2.2.0.
Restoring NuGet package Microsoft.ApplicationInsights.Web.2.2.0.
Restoring NuGet package Microsoft.ApplicationInsights.WindowsServer.2.2.0.
Restoring NuGet package Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.2.2.0.
Restoring NuGet package Microsoft.AspNet.Mvc.5.2.3.
Restoring NuGet package Microsoft.AspNet.Razor.3.2.3.
Restoring NuGet package Microsoft.AspNet.Web.Optimization.1.1.3.
Restoring NuGet package Microsoft.AspNet.WebApi.5.2.3.

我们可以知道没有任何关于包Microsoft.Practices.EnterpriseLibrary的nuget包,如nuget恢复列表中的包Microsoft.Practices.EnterpriseLibrary.Data.dll

所以,首先,请检查您的 package.config 文件是否包含任何关于 Microsoft.Practices.EnterpriseLibrary 的 nuget 包。

然后确保你可以在本地成功构建,然后确保本地代码与服务器上的代码同步。

希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 2018-01-29
    • 2022-01-06
    • 2019-05-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-30
    • 2020-07-21
    相关资源
    最近更新 更多