Jens Kühner

Geek stuff about the .NET, Compact and Micro Framework.

Standalone .NET Micro Framework Emulator

Upon a customers request I figured out how to use the .NET Micro Framework Emulator on a clear machine without Visual Studio 2008 and the .NET Micro Framework SDK 3.0 installed.
Imagine a scenario where you might need to send your device application to someone for demonstration that does not have any MF hardware (because you are in the prototype phase and there is no final hardware yet) and he also is not a programmer having Visual Studio and the MF SDK installed.

The .NET Micro Framework Emulator is in generally a Winforms .NET application. Unfortuately it references one .NET 3.5 assembly,  so the target machine should have at least the .NET Framework 3.5. installed. Just copying the emulator executable would not work because you have to tell the emulator via command line arguments what device assemblies it shall load. That´s what Visual Studio actually does when launching an emulator.

As an example we want to give away the NewPresentationSample application on the Microsoft Sample Emulator.
Therefore copy the files Microsoft.SPOT.CLR.dll, Microsoft.SPOT.Emulator.dll,  Microsoft.SPOT.Emulator.Interface.dll, Microsoft.SPOT.Emulator.Sample.SampleEmulator.exe and Microsoft.SPOT.Emulator.Sample.SampleEmulator.exe.emulatorconfig from the Tools directoy of the MF SDK to a new separate directory. Further copy the following system assemblies from the Assemblies directory of the MF SDK to the same directory as your emulator: mscorlib.pe, Microsoft.SPOT.Hardware.pe, Microsoft.SPOT.Native.pe, Microsoft.SPOT.Graphics.pe, and Microsoft.SPOT.TinyCore.pe. Finally copy the application NewPresentation.pe. Yes you need the .pe files and not .dll files since .pe files are the MF specific assemblies derived from the dlls.

To launch the emulator with the command line arguments we need to create a batch file with the following content:
"Microsoft.SPOT.Emulator.Sample.SampleEmulator.exe" "/load:NewPresentation.pe" "/load:mscorlib.pe" "/load:Microsoft.SPOT.Native.pe" "/load:Microsoft.SPOT.Graphics.pe" "/load:Microsoft.SPOT.Hardware.pe" "/load:Microsoft.SPOT.TinyCore.pe"
Which assemblies need to be loaded you can see in the Debug Output Window of Visual Studio.

Now you can demo your device application everywhere.
(Thanks to Andreas for testing in your machine parc).

Comments

snupi said:

hi

you also have to copy Microsoft.SPOT.Graphics.pe ;)

thx for great article

# December 17, 2008 11:17 AM

jenskuehner said:

Thanks Snupi. Now its corrected. The list of assemblies to copy and those to reference should of course be equal.

# December 17, 2008 11:29 AM

snupi said:

after disassembling and analyzing the emulator i found, that you also need the 'Microsoft.SPOT.CLR.dll' ;)

# December 19, 2008 9:57 AM

jenskuehner said:

Thanks Snupi again for pointing this out. I forgot this asssembly also to mention. Sorry for causing trouble becuase of this.

# December 19, 2008 10:43 AM

snupi said:

no problem jens, was a nice doing to disassemble the emulator and debugging it

# December 19, 2008 10:51 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Please add 4 and 4 and type the answer here: