0

I'm using FileHelpers.dll (v3.0.2.0) to parse a delimited file. It works fine on my development machine but on the dev server it fails on this LOC

var cb = new DelimitedClassBuilder("Delimited", delimiter);
// Do stuff, add fields, etc
Type cls = cb.CreateRecordClass();  // <<<<< This fails on the dev server only
var engine = new FileHelpers.FileHelperEngine(cls);

Exception: Error Compiling Expression: Line 0: An assembly with the same simple name 'Modules.CSV, Version=1.0.0.1, Culture=neutral, PublicKeyToken=null has already been imported. Try removing one of the references or sign them to enable side-by-side.

I don't understand why I don't get the same error?

Any suggestions?

1 Answers1

0

Usually, that error would mean that on your dev server you have two assemblies with the same name (not necessary the file name but the assembly name). You would normally fix it by renaming one of the assemblies from the project's properties and recompiling.

Since you are using FileHelpers which compiles the record classes at run time I would guess that it's something to do with namespace in ClassBuilder conflicting with something else in your solution. You can set the namespace explicitly with

cb.NameSpace = "MyNameSpace";
Type cls = cb.CreateRecordClass();
shamp00
  • 11,106
  • 4
  • 38
  • 81