我在运行时收到此消息:无法加载文件或程序集“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 上的外观:
我尝试了 Skorunka František 的以下步骤,但没有成功:Link to StackOverFlow post
最佳答案
我之前遇到过同样的问题以及我找到的解决方案
- 卸载软件包
- 删除 obj 和 bin 文件
- 从 nuget 包中重新安装
还是不行
- 删除 obj 和 bin 文件
- 添加 => 引用 => 浏览 => 从 C:\Program Files\dotnet\添加正确的 dll
- 重建
希望这对您有帮助!
关于c# - 当项目“"Could not load file or assembly ' Microsoft.Extensions.Logging.Abstractions”时我还能做什么,除了手动清空bin和obj,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75135984/