Issues in working with DLL

Apr 25, 2011 at 3:28 AM

Hi, Govert.

Whenever I wanna work with dll, I keep getting error message saying
External library could not be registered - Path: SinyTest.dll
    Error: Could not load file or assembly 'file:///C:\Users\Sin\Desktop\ExcelDNA\ExcelDna-0.28\SinyTest.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

Even though I placed SinyTest.dll next to .xll and .dna file, it does not work.
Then, if I do not use .dll file and just write the code on to .dna file, it just works perfectly fine.

Do you have any clue?
Thank you so much

Apr 25, 2011 at 7:38 AM


I guess your .dll is compiled targeting the .NET Runtime 4 (this is default under Visual Studio 2010). In that case you have to indicate to Excel-DNA in the .dna file to load the right CLR version.

You'd have something like this:

<DnaLibrary RuntimeVersion="v4.0" />
   <ExternalLibrary Path="SinyTest.dll" />