Welcome to Pete Brown's 10rem.net

First time here? If you are a developer or are interested in Microsoft tools and technology, please consider subscribing to the latest posts.

You may also be interested in my blog archives, the articles section, or some of my lab projects such as the C64 emulator written in Silverlight.

(hide this)

Running a simple .NET console app on the Intel Galileo with Windows

Pete Brown - 20 August 2014

A few weeks back, my friend Morten Neilsen tweeted that he was able to get a .NET console app running on the Intel Galileo with Windows. I was curious because that's not a scenario we thought would work. So, I thought I'd try it out myself.

Please note that .NET is not currently supported on the Intel Galileo, but it's still fun to experiment and see what works and what doesn't.

To join the Windows on Devices program and code for the Galileo, purchase an Intel Galileo Gen 1 from Amazon or another retailer and sign up at http://windowsondevices.com . From there, follow the machine setup and Galileo setup steps for people who have their own board.

Project setup

In Visual Studio 2013, I created a new C# Console Application project.


I left everything at the defaults. Once in the project, I wrote some simple code (most of .NET is unsupported and/or not present, so the code does need to be simple)

using System;

namespace GalileoNetConsoleTest
    class Program
        static void Main(string[] args)
            Console.WriteLine("This is a .NET Test");


I then changed the build properties to compile only for x86. This may be an optional step, but the Galileo is 32 bit x86 only.


Then, I simply copied the file to my Galileo. I use a network drive mapped to C$ ; it is Windows afterall.


Then, in my open Telnet session, I ran the app.




Granted, that was a super simple app, but it's nice to see that it works.

So what works?

You saw that the basic console output works. Similarly, the core language constructs work, as should most/all things in mscorlib/mscoree. The instruction set for the Galileo is missing some things that .NET generally relies upon, however, so most non-trivial code is not expected to work. For example. if you try to use System.Diagnostics.Debug, you'll get a TargetInvocationException saying that System is not present. Same thing with, say, Console.Beep().

You can do a lot of the same types of programs we used to write back when we first learned programming, however. Here's an example that includes a few things similar to the early programs many of us did on the C64.

using System;

namespace GalileoNetConsoleTest
    class Program
        static void Main(string[] args)
            Console.WriteLine("This is a .NET Test");

            for (int i = 0; i < 50; i++)
                Console.Write(i + ", ");

            Console.Write("What is your name? ");
            var name = Console.ReadLine();

            Console.WriteLine("Hello there, " + name);

            string rev = string.Empty;
            for (int i = name.Length - 1; i >= 0; i-- )
                rev += name[i];

            Console.WriteLine("Your name reversed is " + rev.ToLower());

            Console.WriteLine("It is now " + DateTime.Now.ToLongTimeString());

            var rand = new Random();
            var dieroll = rand.Next(5) + 1;

            Console.WriteLine("You rolled " + dieroll);

Copied it over as before, and ran it from the Telnet session window:


Beautiful. :)

Note that my Galileo is on Pacific time, not Eastern time. I didn't pay much attention to that until this little sample. It's easy to change the actual time using the Time command, but setting the time zone requires a bit more work with reg files, or an additional app.

I haven't gone through to figure out exactly what works and what doesn't. However, for now, you can make the assumption that if it's outside of System, it won't work, and if it's inside of System, it may work, depending on which DLL it's implemented in.

Next steps

This is all preliminary stuff. The Windows on Devices program is in its early stages, and as such, Wiring is your best bet in terms of the most mature part of the developer platform. That said, it's nice to see that we can sneak a little .NET on there if we want to :)

As mentioned in the FAQ, our goal with the Windows on Devices program is not just Wiring, but also the Universal App model (headless, of course). For now, it's fun to explore to see how far we can go with both the supported and unsupported features of the current platform.

posted by Pete Brown on Wednesday, August 20, 2014
filed under:      

11 comments for “Running a simple .NET console app on the Intel Galileo with Windows”

  1. Pete Brownsays:

    We're not replacing NETMF. In fact, we're reinvesting in it to improve performance, add modern features, and bring it up to modern dev tools. NETMF can run on microcontrollers and lower end hardware that has lower parts count and low power requirements. This is, in some ways, a step up from that both in capabilities and in requirements.


    Sounds like you found it, but "headless" means there's no UI stack. You could, of course, use displays just like you do with the Arduino, but there's no built-in support for it at an OS level.
  2. Inderpreet Singhsays:
    Did not work for me... the console does not print anything...

    I got the latest version of windows on the SDCARD and Can telnet to the device as well. I am using VS2013 EXPRESS. The app builds and runs ok here but prints nothing on the telnet...

    Anything special I need to do?
    Thanks in advance Sir.

  3. Pete Brownsays:


    Did you follow all the same steps, including the build configuration?

    How are you seeing that it works fine? If the app starts and then finishes on the command line with no output, it may simply have crashed. You won't see anything in the console unless you specifically output something.

    Did you verify that the app deployed to the device? You should see it in the \test\ folder. You can run it directly from there to verify.

  4. Peter Wonesays:
    Hi Pete. I signed up on WindowsOnDevices.com and was fortunate enough to receive the kit. Given that it's 'duino form factor I was very surprised when it dawned on me that this isn't NETMF, and I'm having a lot of trouble understanding what problem MS thinks it solves. Ballsy hardware is nice but as far as I can see the only functional difference from a Netduino running NETMF is it takes twenty times longer to boot.

    On the face of it, this is WORSE, so my question to you is what's the point and what am I missing here? What's the payoff? I always thought NETMF was very suitable for embedded systems.

    I have a Raspberry Pi but it gathers dust partly because it's not very good for interfacing with other hardware, and partly because it takes far too long to boot to be useful.

    I suppose WoD might be useful for building kiosks on R-Pi style hardware if it weren't headless. Help me out here, Pete - what's it FOR?

  5. Peter Wonesays:
    Following on from my question I have thought of two distinct applications for which Windows on a device would be profoundly better than NETMF despite the overheads, but both are rather specialised. I'd love to know what problem space Microsoft sees it as addressing.
  6. Jarred Capellmansays:
    It's great to see .NET supported (if only a subset) out of the gate, which begs the question is there a time table for the move to the Universal App Model? I'd love to get going (just ran out to Frys this morning for a Galileo board), but want to utilize C# and not C++, as the time to develop with C++ with my skillset is orders of magnitude longer.
  7. Greggsays:
    You might recognize me from the space next door belonging to the Netuduino crowd and an interesting discussion concerning what we've got here on your blog. I finally took the plunge and bought one yesterday as I indicated on that one.

    As expected your example works exactly as shown. I find it interesting to see Windows running on that platform. Next will be working with it to enable it to do the things that the company wants us to do with it. I'm also trying out your next example.

Comment on this Post

Remember me