使用Entity Framework Core和Azure Functions v1的相关性错误 [英] Dependency error using Entity Framework Core with Azure Functions v1
问题描述
我已经使用Azure Functions v1模板创建了Visual Studio解决方案.
Func.exe:
Azure Functions核心工具(1.0.12)
函数运行时版本:1.0.11702.0
回购如下:
使用Azure v1项目创建解决方案
添加一个单独的名为Data的类库项目(.net框架)
将Entityframeworkcore.SqlServer添加到数据项目中
添加一个ApplicationDbContext.cs(我使用的版本在控制台应用程序中可以正常工作)
添加对功能项目中数据的引用
初始化_db:
var _db = new ApplicationDbContext();
调试并引发以下错误消息:
System.IO.FileNotFoundException:'无法加载文件或程序集'Microsoft.Extensions.Logging.Abstractions,版本= 2.1.1.0,区域性=中性,PublicKeyToken = adb9793829ddae60'或其依赖项之一.系统找不到指定的文件.'
请咨询.
庞特斯·哈格伦德
您是否尝试过将以下内容添加到函数中
#r".. \ bin \ Microsoft.Extensions.Logging.Abstractions.dll" 使用Microsoft.Extensions.Logging;
I've created a Visual Studio Solution using the Azure Functions v1 template.
Func.exe:Azure Functions Core Tools (1.0.12)
Function Runtime Version: 1.0.11702.0The repo is the following:
Create the solution with an Azure v1 project
Add a separate class library project (.net framwork) named Data
Add Entityframeworkcore.SqlServer to the Data-project
Add an ApplicationDbContext.cs (I've used a version that works fine in a Console application)
Add a reference to Data from the Functions Project
Initialize _db:
var _db = new ApplicationDbContext();Debug and the following error message is thrown:
System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.'
Please advice.
Pontus Haglund
解决方案Have you attempted to add the following to your function
#r "..\bin\Microsoft.Extensions.Logging.Abstractions.dll" using Microsoft.Extensions.Logging;
这篇关于使用Entity Framework Core和Azure Functions v1的相关性错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文