.NET Micro Framwork and Visual Studio 2013
For those of you that have been following my blog you know that I have a love for the AGENT SmartWatch. I have been working on apps for it as well as a “port” of MonoGame for it.
Recently I reinstalled Windows 8.1 as a completely fresh install. I decided that I would use this to finally switch from Visual Studio 2012 to 2013. While I’m loving 2013 so far I ran into one problem. The most recent .NET Micro Framework installer is only for 2012. Since the AGENT SmartWatch uses the .NET Micro Framework as it’s “platform” without it I could not do any development. Being a nerd and a geek I couldn’t accept this and decided that I’d try to make it work. Luckily I did and hopefully this will work for you too.
Before we can get to the fun “hacking” part, first some disclaimers. What I am doing is NOT supported by Microsoft, Secret Labs, the .NET Micro Framework team, the Visual Studio team, or myself. If something breaks from following the instruction I’m giving you can comment, but I not obligated to and may not have an answer. As a follow up to that following the instructions CAN break stuff, even if followed exactly. Also please not that this fix DOES NOT add the new project templates correctly. If you are ok with all that then please continue on reading and let the fun begin.
First problem was that the installer would do a check for Visual Studio 2012 and if it was not installed would throw an error message and not run. Luckily the .NET Micro Framework is open source, including the installer. After looking through the files I eventually came across the file that contains the logic for detecting Visual Studio 2012. All it does is look for the “InstallDir” value in the “HKLM\SOFTWARE\Microsoft\VisualStudio\11.0" key (on 64 bit systems it looks in “HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0"). If it finds the value it assumes 2012 is installed, otherwise it assumes it is not. Solving this issues is as simple as just creating the key and value. The “InstallDir” value is a string value that points to the Install directory of that version of Visual Studio. Since we are trying to trick the installer set the value as the location of Visual Studio 2013.
Now you can run the .NET Micro Framework installer. File wise everything works correctly since it uses the location from the registry to put files in Visual Studio that it needs to. unfortunately the same cannot be said of the registry, though it is fairly easy to fix.
Navigate back to “HKLM\SOFTWARE\Microsoft\VisualStudio\11.0" key (on 64 bit systems “HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0"). Under the “11.0” key you will notice a lot of keys and values. What you need to do is find the keys that are for the .NET Micro Framework integration and copy them to the “12.0” key (the numbers 11.0 and 12.0 are the internal version numbers of 2012 and 2013 respectively). If you use RegEdit like there is sadly no copy ability. A trick I used to overcome that was to export the key I wanted to copy to a .REG file. Once it was exported I would edit the file, which is really just a simple text file. I would replace all the references to “11.0” with “12.0”, save the file, and then open it.
Once you’ve moved them all there is only one step left. While we have set everything up correctly, we need to tell Visual Studio to “load” the changes. To do this you simply run Visual Studio with the “setup” flag. On my machine that looked like
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe" /setup
It may take a while to run so keep an eye on it from Task Manager. Once it finishes though you should be able to open existing .NET Micro Framework projects.
Microsoft, ARM, and Windows RT
Originally I was going to have a post replying to Wes Miller’s “Windows Server on ARM processors? I don’t think so" and one replying to Paul Thurrott’s “Assessing the Chromebook Threat”. As I thought more about my replies I realized that the two we’re not only going to have some crossover but in some cases require something from the other. Therefore I have combined the two into one.
As a quick overview of the two posts Miller argues against a Windows Server RT appearing and Thurrott shows how Chromebooks don’t threaten Microsoft too much, currently.
Generally speaking I agree with Miller that a Windows Server RT just will not happen because what ARM brings to the platform just isn’t really need in the end (see Itanium). Technically speaking both server and client are using the same core and that has been ported to ARM, though that is not to say there is nothing more to do. I think though that Microsoft might want to “finish the job” for one reason. Not to make Windows Server RT but to help make the code more portable for the future. After all that is one of the strengths of the NT core, and the reason that not only is still used after all these years but is now used for Windows Phone too. Expanding on that ability (to a point of course) I think would be a good idea.
As to Thurrot’s dismissal of Chromebook I see his point but then I think about my friends working in BestBuy and what they tell me. While they don’t say the Chromebooks are a extreme hit they are moving and not a lot of returns. So I have to think about what people are doing on their computers. I’ll use my mom as the cliche example. She checks her email,checks Facebook, plays Facebook games, and uses Facebook chat (from Facebook.com). Would a Chromebook work for her? Sure! everything she is doing is web-based (she currently uses Outlook 2013 to check email but that could easily enough be changed to Outlook.com). Another thing we need to factor is that while Google is not Apple and doesn’t have their scary good Reality Distortion Field™ they seem to still be able to hide behind “Do no Evil” and get the love of the public (though recent Google actions are starting to hurt that). Even more people love using Chrome to browse with, “Its fast”, “I can develop right in it”, “it integrates with all my Google stuff so well”, and more. So I disagree with Thurrott in the long term. Right now they may not be much of a threat but give them enough time and Google make them a threat.
So far I’ve just replied to each article on its own but here’s the connection. While here I talked about Miller’s post first and Thurrott’s second I read the originally the other way around. As such Miller’s I think just happens to give a solution to the Chromebook threat. Not only that but it the solution is something Microsoft already has but just is not using in this way.
That solution is “Kiosk Mode” that comes with Windows 8.1, which for those of you who don’t know is a mode that locks an account to be able to only run a selected Metro/Modern app. Obviously this is meant for places like an airport to allow flyers to self check-in. But as the Geek.com notes in “Windows 8.1 kiosk mode locks systems to a single app" this could easily make an ExplorerBook(?) by making the single app Metro/Modern Internet Explorer. But what I want to add is that Kiosk Mode is available on Windows RT. Let that sink in for a minute. Windows RT runs on ARM, so (in theory) it can be on cheaper hardware. And as Thurrott notes in "Surface 2 Review”, on the right hardware Windows RT can be pretty snappy.
Now lets check those advantages of a Chromebook again:
- Cheaper. Windows RT running ARM can be too.
- Web Only so much simpler. Locked into Internet Explore.
- Runs the “Fast” Chrome. IE 11 is pretty darn fast now.
- Integrates well with Google ecosystem. Can’t directly with that but IE isn’t made for the open web so you can use ANY ecosystem.
So about those advantages…
What Microsoft Could But Will Never Do With MS Accounts
We all remember carrying around floppies, then CDs, and then flash drives so that when we went to use a library or friend’s computer or simply another computer we owned we would have our files. Problem was that even if we had our files we had to hope that the computer had a program that could open them. Common file types like JPG and DOC were pretty safe with but a program to open a PSD, much less likely.
Then we got things like Folder Share which allowed us to keep files in sync between our own computers. After that came SkyDrive and DropBox allowing use to not only sync the files but also access them from a web portal so we could get at them from computers that were not our own.
Now we come to today were both iOS and Windows 8 do not just sync files and have web access but saves your settings and what apps you have installed so getting a new machine or reinstalling the OS (or a factory reset) is way less painful then it use to be. But there are sadly some steps that we will like never truly see.
Imagine going to a friends computer and just logging in with your account. immediately a set of default apps you like to have are downloaded, the machine is configured with the settings you like and your files are pulled down from the cloud (or linked like SkyDrive in Windows 8.1 does). In essence you have just transformed your friends machine into your own by just logging in. Not only that but when you’re done besides signing out you can also remove your profile from the machine, completely undoing everything we just listed. This leaves the machine is the exact same state as when you came over.
Now I admit this sounds very much like what you can already do today but there is a subtle difference. The current system we have is designed for case where you replace a machine or make it like new, NOT for brand new machines. If I get a second laptop I do not want it to be exactly the same as my first one. What I would want is a common “personal install” for that machine when I log in.
What I am suggest is Microsoft could take a concept that we already have, the Default Profile, and extend it to the cloud. For those who do not know the Default Profile is a user profile that is used as a template for new user accounts. Those default icons in your start menu or on your desktop come from there. But what if Microsoft create a similar concept but was something you edited from a web page that allowed you to set default settings that you wanted every new computer you log into to have? Obviously during install you could also choose to use and existing computer as you can now.
Sadly Microsoft will not do this. Why? They will not because now a days very few people go and use library computers or a friends. This is because they all have tablets or ultrabooks of some kind making it easier to just use their own machine. Do I still want this ability? YES. Will I get it though? I suspect not.
Why I Was Gone So Long
For those who follow my blog you’ll have noted that I haven’t blogged for just over 3 months! I admit that’s a long time.
The primary reason for this was I was working crazy hours at work. The good news is that I have been laid off so now I’ll have the free time to post. Of course the bad news is that I’m looking for a new job (wink-wink-nudge-nudge)
MonoGame .NETMF for AGENT Smartwatch Faces
Over the summer I started a library that is API based on MonoGame (that is the function and the like look very similar to the MonoGame ones but will usually have differences) for the .NET Micro Framework.
The reason for this is that I had just pre-ordered a AGENT Smartwatch and being a MonoGame Evangelist I thought it would be cool to try and port MonoGame to the watch. Obviously that did not work, primarily because of limitation in the Micro Framework compare to the “non-Micro” Framework.
As I started to mess around with the “MonoGame” and the watch’s SDK I realized that that it could be used for more than just creating watch games (or companion games to games on other Bluetooth enabled devices). At its core what MonoGame gives you is a way to redraw the screen (or a Window on desktops) in a very fast loop. This sounds very much like what you want to create a watch face for AGENT. You loop to update the time as well as animations you probably have.
So why not use it? Well it does over complicate it if you are just creating a simple watch face that shows say the time in two or three time zones at ones. And I suppose if you hate XNA and/or MonoGame I wouldn’t use this either, but how you could hate them I don’t know!
I personally plan to convert my watch faces to use MonoGame .NETMF and use it for all future ones too.
.NET, Cross-Platform, and Me
In .NET Cross-Platform usually means across the Windows/Microsoft ecosystem: Desktop/Xbox/Phone/Compact/Micro/RT. Conventionally a developer did this by using linked files and compilation flags. Linked Files are a feature of Visual Studio that allows a developer to include a file in a project but not copy the file. Its kind of like creating a shortcut for files in Windows.
The newer way that is growing popularity is the use of Portable Class Libraries (PCLs). PCLs use a technology in .NET called type forwarding to allow developers to create assemblies that target more than one profile at a time. The idea is a lot nicer than using Linked Files since you only need to compile once and yet you can reference it from each platform.
Primary downside though is that PCLs work only with the lowest common denominator for the platforms you want to use. This means that the more platforms you add the less classes are available to use. It also means that any code that is never common is never available.
Its that last point that hits the most for me because to me Cross-Platform with .NET means using Mono to target OSX and eventually iOS as well as Android. In these cases PCLs fall down really fast leaving me with only Linked Files and compilation flags. Would long term I’d like to use type forwarding to make PCLs maybe work but for now I’m suck.
Being unconventional has its down sides :)
Build 23 Days Late
It maybe 23 days late but hears by round up of //BUILD/.
For starters it was great to meet so many great people that I only knew on twitter before hand and now met at least in person while some I can count as people I’d hang out with just because. I also got some books signed
For the few people who will read this and don’t know Microsoft gave all attendees:
- A Surface Pro 128GB
- A Iconia W3
- A year of Office365 Home Premium
- A year of Adobe Creative Cloud
- A year of 100GB of SkyDrive Storage
Ok now while I’d love to talk about the sessions and the new stuff Microsoft announced I feel like Mary Jo Foley, Iris Classon, and the like did a pretty good job during and right after //BUILD/ talking about that. I on the other hand spent most of my time at the show on the partner floor and I’m going to talk about the partners from there that I find really great.
- VSAnyWhere: A really cool collaboration tool that brings the group editing features we have in things like Google Docs to Visual Studio. It makes pair programming remotely much easier as well as some teaching scenarios. I did find the Skype integration not that useful if you have a lot of contacts like I do. Honestly a great product though and their is a free version which is just limited to public sharing and one project at a time.
- Buddy: They are a cross platform analytics company with honestly some of the best Tech Support I have ever gotten. One of the nicest features they have is that they expose and show in their documentation all the HTTP web calls the their SDK makes so if you want to use a platform that they don’t support you can just make those calls your self.
- PreEmptive is another analytics company. They differ from Buddy in that their SDK is ejection based using attributes on your methods as well as their crash reporting is much better. Downside is their cross platform support isn’t as good as well as they don’t officially show the HTTP calls they make so you can do it your self (though if you were to you’d lose some of the advantages of them).
- Xamarin: I’m sure readers of my blog know I’m a huge Xamarin fan. In a nutshell Xamarin allows you to develop in C# for iOS, Android, and MacOSX. This allows you to share code between platforms as well as simplifying the learning curve to go to a new platform.
- Twilio: With Mobile becoming a big thing texting is also growing and yet adding texting to our apps and services can be hard. Twilio makes it easy. They provide simple to use API for both sending and receiving text messages. And if you need extreme security why not use them for two-auth?
Those are the major partners I saw. Think I missed any? Let me know!
Day 0 At Build
While Build officially starts tomorrow (or today depending on how you look at it) There was plenty of stuff to do today (25th).
First there was the Xamarin Party where I got to meet Scott Hanselman, Miguel de Icaza, tons of Xamarin staff, and Steve Williams.
Then I went to the Nokia dinner where I got to catch up with Lance McCarthy and Mary Jo Foley. I got to meet Ed Bott, Chevon Christie, and Iris Classon (who was at least 10 times cooler than I thought she’d be).
After going back to the Xamarin party for a while we heard there was a second Nokia party. Not wanting to miss out on any fun we went to where the party was suppose to be. Apparently though while there was a party it was a wedding…woops!
So that sums up day 0. Mostly meeting tons of people. Tomorrow the fun begins!
MonoGame on the AGENT Watch
In what can only be called an insane move I’ve decided to try porting MonoGame to the AGENT Watch. In a net shell the AGENT Watch is a watch that runs the .NET Micro Framework (the smallest version of the .NET Frameworks designed to run on hardware WITHOUT an Operating System) allowing for custom “watch faces” as well as apps.
Why would I do this? After all I doubt there are going to really be any need for cross platform game development with a watch ;)
- It’s an excuse to learn more about how MonoGame works on the inside.
- On the topic of how it works because the watch uses the Micro Framework a lot of things we take for granted in .NET/Mono like string.Format and List<T> aren’t there. Therefore I need to learn how these things work so I can build them.
- I’ve wondered for a while if MonoGame could be adapted to draw to a System.Drawing.Bitmap and what do you know that’s what you draw to on the watch to draw to the screen!
To tackle this my first goal is to deal with the problem I mentioned in #2. Currently for a lot of things I’m looking to Mono actually for how to do it, though in many cases I can’t uses things exactly as are and have to adapt them (for instance I can’t add Format back to the string class. Best I can do is make my own String class and use #ifdef to switch calls from string.Format to myString.Format).
I won’t be porting MonoGame perfectly though (at least at first). These limits are both based on limits of the watch and time I have:
- No 3D stuff, only 2D.
- No Media. That means no Songs, Sounds, or Video
- No Networking. While the watch includes Bluetooth to communicate with a phone because that works so differently than the networking APIs in MonoGame for now I’m leaving it out.
Currently I’m fighting my way through making LINQ work in the Micro Framework, though if it fails enough I might just give up and manually remove LINQ usage.
Tom Spilman pointed out to me on GitHub that the .NET Micro Framework does not support Generics which I had incorrectly thought it did. Sadly this will put this port way behind but I’ll still keep at it!
Going to Build!
Well I’m leaving for Microsoft’s //BUILD tomorrow afternoon. I hope to blog and tweet plenty while I’m there but we’ll see.