C# 核心应用程序和 Dapper
C# Core application and Dapper
我有一个 .Net 4.6 WebAPI->LogicLayer->Data Accessor 应用程序...Data Accessor 使用 Dapper 从数据库中获取数据。
我正在转换为 Core,所以从 WebAPI 层开始。但是马上,当我的逻辑层调用我的数据访问方法时,我得到一个错误:
"ClassName": "System.IO.FileNotFoundException",
"Message": "Could not load file or assembly 'Dapper.StrongName, Version=1.50.4.0, Culture=neutral, PublicKeyToken=e3e8412083d25dd3'. The system cannot find the file specified.",
"Data": null,
"InnerException": null,
"HelpURL": null,
"StackTraceString": " at Data.AuthenticationData.AuthenticateAsync(LoginRequest request)\r\n at Logic.AuthenticationLogic.<AuthenticateAsync>d__3.MoveNext() in C:\Storage\VSTS_Repo\Home Finance\Logic\AuthenticationLogic.cs:line 36\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at AuthenticationService.Controllers.AuthController.<LoginAsync>d__0.MoveNext() in C:\Storage\VSTS_Repo\Home Finance\01.AuthenticationService\Controllers\AuthController.cs:line 25",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": null,
"HResult": -2147024894,
"Source": "Data",
"WatsonBuckets": null,
"FileNotFound_FileName": "Dapper.StrongName, Version=1.50.4.0, Culture=neutral, PublicKeyToken=e3e8412083d25dd3",
"FileNotFound_FusionLog": ""
出于某种原因,当它尝试连接到我的数据访问器项目 (4.6) 时出现错误,这就是错误。自从将 WebAPI 层转换为核心层后,我怎样才能让它工作?
请注意,我发现了一个问题,用户从 Dapper 更改为 Dapper.StrongNamed 并且它有效,但这并没有解决我的问题,我想恢复到 'Dapper'。我没有更新。即软件包是最新的。这听起来也可能是 Core 和 'referenced libraries' 的问题,但是......我不确定如何解决它。
(通过 Nuget 添加 'Dapper' 到 API 项目解决了这个问题,但这看起来不像 'solution')
将所有项目转换为核心,问题就消失了。似乎是引用和 .Net 版本混合的问题。
我有一个 .Net 4.6 WebAPI->LogicLayer->Data Accessor 应用程序...Data Accessor 使用 Dapper 从数据库中获取数据。
我正在转换为 Core,所以从 WebAPI 层开始。但是马上,当我的逻辑层调用我的数据访问方法时,我得到一个错误:
"ClassName": "System.IO.FileNotFoundException",
"Message": "Could not load file or assembly 'Dapper.StrongName, Version=1.50.4.0, Culture=neutral, PublicKeyToken=e3e8412083d25dd3'. The system cannot find the file specified.",
"Data": null,
"InnerException": null,
"HelpURL": null,
"StackTraceString": " at Data.AuthenticationData.AuthenticateAsync(LoginRequest request)\r\n at Logic.AuthenticationLogic.<AuthenticateAsync>d__3.MoveNext() in C:\Storage\VSTS_Repo\Home Finance\Logic\AuthenticationLogic.cs:line 36\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at AuthenticationService.Controllers.AuthController.<LoginAsync>d__0.MoveNext() in C:\Storage\VSTS_Repo\Home Finance\01.AuthenticationService\Controllers\AuthController.cs:line 25",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": null,
"HResult": -2147024894,
"Source": "Data",
"WatsonBuckets": null,
"FileNotFound_FileName": "Dapper.StrongName, Version=1.50.4.0, Culture=neutral, PublicKeyToken=e3e8412083d25dd3",
"FileNotFound_FusionLog": ""
出于某种原因,当它尝试连接到我的数据访问器项目 (4.6) 时出现错误,这就是错误。自从将 WebAPI 层转换为核心层后,我怎样才能让它工作?
请注意,我发现了一个问题,用户从 Dapper 更改为 Dapper.StrongNamed 并且它有效,但这并没有解决我的问题,我想恢复到 'Dapper'。我没有更新。即软件包是最新的。这听起来也可能是 Core 和 'referenced libraries' 的问题,但是......我不确定如何解决它。
(通过 Nuget 添加 'Dapper' 到 API 项目解决了这个问题,但这看起来不像 'solution')
将所有项目转换为核心,问题就消失了。似乎是引用和 .Net 版本混合的问题。