Porting .NET .dll to .NET MF

This is my first post and I’d like to say thank you to everyone at GHI for developing such great products.

I’m working with a third-party .NET 32-bit .dll used to drive a motor through a USB interface. I’ve successfully compiled and run a .NET Framework 2.0 Windows Application using the third-party .dll to control the motor using my PC.

However, I’m now trying to port the .dll over to my FEZ Spider board and hope to drive the motor through the USB Host module. Just adding the .dll into my .NET MF Framekwork 4.1 gives me an error of .pe file in a path relative to the .dll path. I do not have a .NET MF proprietary .pe file, only the .NET Framework 2.0 .dll. I have asked the supplier to see if they could port their code over to be .NETMF compatible, but I’m not holding out any hopes.

I’ve attempted to use the MetaDataProcessor.exe command line tool provided with the .NET MF Porting Kit 4.1 and 4.2 to convert the .dll to the .NET MF proprietary .pe format.

MetaDataProcessor.exe -loadHints mscorlib mscorlib.dll -parse <dll File Name>.dll -minimize -compile <pe File Name>.pe

But I get the following error:

error MMP0000: Cannot resolve type System.Runtime.CompilerServices.CompilerGeneratedAttribute from assembly <dll File Name>!

MMP: error MMP0000: CLR_E_FAIL

My current plan of action is to:
[ul]See if I can obtain the supplier’s source code used to make the .dll so I can port the code to .NET MF by replacing multidimensional arrays to be replaced with jagged arrays. Is there any documentation comprehensively detailing what else needs to be changed during a port from .NET to .NET MF? Nonetheless, I’m not too optimistic I can get my hands on the source.[/ul]
[ul]Try another communication protocol such as CANOpen instead of USB.[/ul]

I’ve scoured the internet and can’t seem to find a solution to this problem. Sorry if there’s an obvious answer to this.

Thank you so much for your help. Any comments or even suggestions on where I should look are appreciated.

You need the source but what controllller are you using?

Welcome to the community and thanks for the good words.

I’m using a Maxon EPOS2 Positioning Controller.

Looks like it supports serial as well. This maybe the easiest way.

Sounds like an interesting project.

Hi FN,

Not sure what the license for the DLL allows, but have you thought of using .NET Reflector?

If the DLL isn’t obfuscated, there’s a good chance you can create a source project…which you can then tweak to be compatible wtih .NET MF.


Gus, thank you for the feedback. By serial, do you mean the RS232? I think the RS232 is actually quite similar in implementation to the USB and I may still be stuck writing the low-level data frames manually without the .pe loaded on the FEZ board.

Chris, funny you should propose that. I thought of .NET Reflector last night. To be honest, I was wondering whether that path was too daunting of a task this morning, so it’s definitely reassuring that you also came to the same conclusion. I’ll have to do some digging. Thank you for the suggestion!

We tend to do quite a bit of security analysis and reverse engineering around here. :slight_smile:

Sometimes we can actually reflect a DLL, add or change a feature, recompile it, and it works. Usually we need to tweak things, but I’m amazed how much commercial code is not at least obfuscated.

Come to think about it, that’s one of the nice things about open source code…no need to obfuscate, no need to reflect. Open on purpose.


1 Like