![](/img/trans.png)
[英]How to install visual studio 2010 setup project with MS Access database on a computer which is not having Office 2010 installed?
[英]Microsoft.Bcl.AsyncInterfaces error (in CSVHelper method) when running the application installed by Visual Studio Setup project
我有一个 WPF 应用程序,它使用我使用CSVHelper
安装的NuGet
读取 CSV 文件。 这是项目、系统等版本信息。
Microsoft Windows 7 专业版 6.1.7601 Service Pack 1 Build 7601
Microsoft Visual Studio 社区 2019 版本 16.4.5
NuGet Package 管理器 5.4.0
WPF 项目目标框架:.NET 框架4.7.2
CSVHelper 版本:15.0.5
CSV 阅读器方法很简单; 读取文件并将其放入列表中。 没有什么花哨。 我将在底部链接整个项目,以便您可以下载并尝试一下。
当我运行在Release
或Debug
版本中生成的可执行文件时,它们工作正常。 他们读取文件,将内容放入列表中,然后在DataGrid
上显示就可以了。 下一步,我创建了一个标准的Visual Studio Setup
项目,并创建了一个msi
安装程序,用于在我的 PC 中安装应用程序。
但是,当我运行该可执行文件(位于我的 Program Files 目录中)时,应用程序会引发异常。 这是异常消息和堆栈跟踪。
Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)
at ReadCSVTest.MainWindow.ReadPeopleList(String path, List`1& people, String& msg)
at ReadCSVTest.MainWindow..ctor()
由于错误说无法加载程序集Microsoft.Bcl.AsyncInterfaces
,我从 NuGet 添加了它并再次运行所有内容,但我仍然收到错误。 这里有什么问题? Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context.
Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context.
? 为什么我只有在运行安装项目安装的可执行文件时才会出现这个异常?
请从这里下载整个项目。
就像将来任何人都会遇到同样的问题一样; 正如琼斯在评论中建议的那样,将两个库中的每一个降级到以下版本为我解决了这个问题。
CsvHelper ==> 12.3.2
和
Microsoft.Bcl.AsyncInterfaces ==> 1.0.0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.