c# - 当项目“"Could not load file or assembly ' Microsoft.Extensions.Logging.Abstractions”时我还能做什么,除了手动清空bin和obj

标签 c# .net azure entity-framework azure-functions

我在运行时收到此消息:无法加载文件或程序集“Microsoft.Extensions.Logging.Abstractions”

我尝试了 Skorunka František 的以下步骤,但没有成功:Link to StackOverFlow post

这就是我的startup.cs 文件在我的项目中的样子。它基本上来自 MSDN 文档:Link here

[assembly: FunctionsStartup(typeof(HiQFoodCourt.Functions.StartUp))]

namespace HiQFoodCourt.Functions
{
    public class StartUp : FunctionsStartup
    {
        public override void Configure(IFunctionsHostBuilder builder)
        {
            string connectionString = "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=master;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False";
            
            builder.Services.AddDbContext<ApplicationDbContext>(
              options => SqlServerDbContextOptionsExtensions.UseSqlServer(options, connectionString));

            var mapperConfig = new MapperConfiguration(x =>
            {
                x.AddProfile(new MappingProfile());
            });

            IMapper mapper = mapperConfig.CreateMapper();
            builder.Services.AddSingleton(mapper);
        }
    }
}

我不知道如何解决和处理这个问题。 下面是它在 Visual studio 上的外观: Visual on Visual studio

我尝试了 Skorunka František 的以下步骤,但没有成功:Link to StackOverFlow post

最佳答案

我之前遇到过同样的问题以及我找到的解决方案

  1. 卸载软件包
  2. 删除 obj 和 bin 文件
  3. 从 nuget 包中重新安装

还是不行

  1. 删除 obj 和 bin 文件
  2. 添加 => 引用 => 浏览 => 从 C:\Program Files\dotnet\添加正确的 dll
  3. 重建

希望这对您有帮助!

关于c# - 当项目“"Could not load file or assembly ' Microsoft.Extensions.Logging.Abstractions”时我还能做什么,除了手动清空bin和obj,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75135984/

相关文章:

c# - 在 C# 中加密并在 Flex 中解密

c# - 将字符串和字符放在一起的性能

azure - Microsoft Azure - 地理和本地冗余

c# - 框架 4 和框架 4 客户端配置文件 : What is the difference?

c# - 如果 MySQL 表中的字段为空,则更新该字段

.net - 在.NET中获取Windows XP颜色

c# - Microsoft.Crm.Sdk.Samples.HelperCode 无法编译

Azure AD B2C 自定义身份提供商

c# - 检测 sql-server 表上的更改

c# - 我如何重写此代码以避免 "Linq to entities Does not recognize method"错误