i'm new @ c#, bear me if misunderstand something.
i have old application @ job allows import dll's automated tasks. old programmers left years ago , have no support contact application. created dll in visual studio 2013 using .net 2.0 framework , error message when trying import it:
the format of file 'mydll.dll' invalid. type:system.badimageformatexception source: mscorlib stack trace: @ system.reflection.assembly.nload(assemblyname filename, string codebase, boolean isstringized, evidence assemblysecurity, boolean throwonfilenotfound, assembly locationhint, stackcrawlmark& stackmark) @ system.reflection.assembly.internalload(assemblyname assemblyref, boolean stringized, evidence assemblysecurity, stackcrawlmark& stackmark) @ system.reflection.assembly.loadfrom(string assemblyfile, evidence securityevidence, byte[] hashvalue, assemblyhashalgorithm hashalgorithm) @ system.reflection.assembly.loadfrom(string assemblyfile) @ applications.frmapplications.loadfields() @ applications.frmapplications.fillmenuitem() @ applications.frmapplications.ugapplications_afterselectchange(object sender, afterselectchangeeventargs e) @ infragistics.win.ultrawingrid.ultragrid.onafterselectchange(afterselectchangeeventargs e) @ infragistics.win.ultrawingrid.ultragrid.fireevent(grideventids id, eventargs e) @ infragistics.win.ultrawingrid.ultragrid.selectnewselection(type type, selected selected) @ infragistics.win.ultrawingrid.ultragrid.internalselectitem(iselectableitem item, boolean clearexistingselection, boolean select) @ infragistics.win.ultrawingrid.ultragridrow.set_selected(boolean value) @ applications.frmapplications.searchforapplication() i looked error online , basic consensious using wrong .net framework version. have used .net reflector see version older dll works using, , comes version 1.1.12.30886 . question is there way round error, or can dll .net versions 1.1 imported? , if there way change dll's 1.1 framework, see past life cycle , no longer supported , don't see way install in visual studio.
if have sources application, can recompile latest .net framework. .net , c# teams work hard make versions compatible, won't have single error.
sticking 1.1 (or 2.0) framework bad idea - it's restrictive compared modern versions, , you've noted, it's unsupported. if want to, you'd have download old version of visual studio / sharpdevelop / monodevelop / whatever. 1.1 still in time when each .net framework had own visual studio version - you'd need visual studio 2003.net work 1.1.
that said, didn't have trouble interop between different .net framework versions. however, need make sure both versions of framework installed - newer versions of framework not contain old versions (so 2.0 doesn't include 1.1, , 4.0 doesn't include 2.0 or 3.5). can fix application manifest (assembly rebinding), can tricky.
another common source of badimageformatexception bit-ness. default, .net uses anycpu nowadays, means use 64-bit if available, , 32-bit otherwise. it's possible 1 of projects uses 32-bit while other uses 64-bit, example.
Comments
Post a Comment