簡體   English   中英

當項目“無法加載文件或程序集‘Microsoft.Extensions.Logging.Abstractions’時,我還能做什么,除了手動清空 bin 和 obj

[英]What else can I do when the project "Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions" except manually empty the bin and obj

我在運行時得到這個:Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions

我嘗試了 Skorunka František 的以下步驟但沒有成功: 鏈接到 StackOverFlow 帖子

這就是我的 startup.cs 文件在我的項目中的樣子。 它基本上來自 MSDN 文檔: 鏈接在這里

[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 Studio 上的視覺效果

我嘗試了 Skorunka František 的以下步驟但沒有成功: 鏈接到 StackOverFlow 帖子

我以前遇到過同樣的問題和我找到的解決方案

  1. 卸載 package
  2. 刪除obj和bin文件
  3. 從 nuget package 重新安裝

那還是不行

  1. 刪除obj和bin文件
  2. 添加 => 參考 => 瀏覽 => 從 C 添加正確的 dll:\Program Files\do.net\
  3. 重建

希望這對你有幫助!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM