This is the segment of code I used, note the **** is the replacement for my name
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();
}
}
I recieved the exception whilst using the ArduinoUploader to upload a .hex file onto an arduino whilst in Visual Studio 2019.
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)'
These are the details
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
I do not know how I should go around troubleshooting this or if it is a resultant of the ArduinoUploader package using an older verison of the .NET framework, or if there is anyway to fix this at all. The code is written in C#.
You can rebind assemblies in many ways, the easiest for me personally is in the config file. Below from
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>
Do note however that there are no guarantees the assembly you have will work as you expect, be it older or newer. I'd suggest you try to find the right one. That said, if you can't, then above is your best shot.
I hear you OP. You must understand that you need to install another NuGet package, that being IntelHexReader. Its written by the same lad, TwinEarthSoftware. Search for it in Visual Studio. You don't need to inculde it when defining the directories used. The has nothing to do with.NET framework, its just suggesting that it needs 2.2.3.0 of the IntelHexFileReader.
User contributions licensed under CC BY-SA 3.0