When I try to read my EDI file I get the following error:
"Could not load file or assembly 'AssemblyName' or one of its dependencies. The system cannot find the file specified."
How to resolve it?
The error message means that there is no reference to the aforementioned assembly. The assembly name is specified in the reader constructor like this:
using (var ediReader = new X12Reader(ediStream, "AssemblyName"))
Internally the parser uses Assembly.Load(AssemblyName) where the assembly name can be found in the project references.
For example - to read EDI files, according to EDI templates that are compiled as part of a project named "EdiFabric.Sdk.X12.Templates.V004010" with assembly name:
you need to:
- Add a reference to that project
- Use the exact assembly name in the reader constructor
var ediReader = new X12Reader(ediStream, "EdiFabric.Sdk.X12.Templates.V004010")