这是我使用的代码段,注意*是我名字的替换
using System;
using ArduinoUploader;
using ArduinoUploader.Hardware;
namespace SoftwareAssignment
{
class Program
{
static void Main(string[] args)
{
var uploader = new ArduinoSketchUploader(
new ArduinoSketchUploaderOptions()
{
FileName = @"C:\Users\****\OneDrive\Desktop\Blink\Blink.hex",
PortName = "COM5",
ArduinoModel = ArduinoModel.Micro
});
uploader.UploadSketch();
}
}我在Visual Studio2019中使用ArduinoUploader将.hex文件上传到arduino时收到异常。
System.IO.FileLoadException: 'Could not load file or assembly 'IntelHexFormatReader, Version=2.2.3.0, Culture=neutral, PublicKeyToken=null'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)'以下是详细信息
System.IO.FileLoadException
HResult=0x80131040
Message=Could not load file or assembly 'IntelHexFormatReader, Version=2.2.3.0, Culture=neutral, PublicKeyToken=null'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)
Source=ArduinoUploader
StackTrace:
at ArduinoUploader.ArduinoSketchUploader.UploadSketch(IEnumerable`1 hexFileContents)
at ArduinoUploader.ArduinoSketchUploader.UploadSketch()
at SoftwareAssignment.Program.Main(String[] args) in C:\Users\****\source\repos\SoftwareAssignment\SoftwareAssignment\Program.cs:line 20我不知道我应该如何解决这个问题,或者它是否是使用旧版本的.NET框架的ArduinoUploader包的结果,或者是否有任何方法可以修复这个问题。代码是用C#编写的。
发布于 2020-05-30 14:56:30
你可以用很多方法重新绑定程序集,对我个人来说,最简单的方法是在配置文件中。下面来自
https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions
<dependentAssembly>
<assemblyIdentity name="someAssembly"
publicKeyToken="32ab4ba45e0a69a1"
culture="en-us" />
<bindingRedirect oldVersion="7.0.0.0"
newVersion="8.0.0.0" />
</dependentAssembly>但是,请注意,不能保证您拥有的程序集将按照您的预期工作,无论它是旧的还是新的。我建议你试着找一个合适的。也就是说,如果你不能,那么上面就是你最好的选择。
发布于 2020-06-23 17:11:10
我听到你的声音了。您必须了解,您需要安装另一个NuGet包,即IntelHexReader。这是由同一个男孩写的,TwinEarthSoftware。在Visual Studio中搜索它。在定义所使用的目录时,您不需要包含它。与with.NET框架无关,它只是建议它需要2.2.3.0版本的IntelHexFileReader。
https://stackoverflow.com/questions/62097806
复制相似问题