Win10 development in VB and .NET - getting started

This is Part 1 of my "VB Win10 Apps" series. (this list is just my rough thoughts on what to write. I'll amend it based on what I get sucked into, and what areas you folks ask me to do in comments).

 

Win10 development in VB and .NET - getting started

I'm excited to be writing Win10 apps in VB. For me the biggest promise is

Write just a single app and it can run windowed on Desktops, and can run on tablets and phones and even HoloLens.

Over the coming weeks I'll be writing more odds and ends about Win10 development as I learn about them. Here's my first "getting started" post.

 

  1. Your machine should be running Windows 10, build 10130 or higher, from here: https://insider.windows.com/
    1. I installed it "clean" on my SurfacePro1. To do this, first download the ISO of Windows10 from http://windows.microsoft.com/en-us/windows/preview-download, and then use "Rufus" http://rufus.akeo.ie/ to create an installable USB image from the ISO. Within Rufus, for my SurfacePro1, I had to choose "FAT32" and "GPT for UEFI". I don't know what you need on other machines.
       
  2. Install VS2015 RC from here: https://www.visualstudio.com/en-us/downloads/visual-studio-2015-downloads-vs.aspx
    1. During installation, you get to choose which components to install. You should choose "Windows 10 tools and emulators".  Installation takes from one to several hours.
    2. It will install Windows 10 SDK version 10069.
    3. There are some glitches with the installer. If you go back to AddRemovePrograms and modify which components of VS2015 RC are installed, then it ends up installing more than it really should.
    4. When VS runs for the first time, it asks if you want to sign in. I always used to click "no" and it'd then ask me more configuration questions. But if I answer "yes" and I sign in, then it bypasses all those configuration questions, and ends up being quicker. Lesson learned: I now always sign in.
       
  3. You can run Win10 apps upon emulators. The emulators came with the Win10 SDK, and so are running version 10069 of the Win10.Mobile operating system.
     
  4. You can run Win10 apps on your local machine. To do this you local machine must be Win10.Desktop version 10074 or higher and must be unlocked.
    1. Instructions for unlocking are at https://msdn.microsoft.com/en-us/library/windows/apps/dn706236.aspx. Here's a "TL;DR" version:
    2. Build 10122 or higher: Settings > Updates And Security > For Developers > Developer Mode. (If it pops up a dialog complaining that the change is blocked by group policy, that doesn't matter: even if you click No it nevertheless still works).
    3. Build 10074: Run gpedit.msc > Local Computer Policy > Computer Configuration > Administrative Templates > Windows Components > App Package Deployment. Then right-click to enable two things,
      1. "Allow all trusted apps to install"
      2. "Allow development of Windows Store apps"
         
  5. You can run Win10 apps on your phone. To do this your phone should be Win10.Mobile version 10136 or higher (which came out on June 14th). Your phone must be unlocked.
    1. Instructions for unlocking are at https://msdn.microsoft.com/en-us/library/windows/apps/dn706236.aspx. Here's a "TL;DR" version:
    2. Plug your phone in by USB. Run "Windows Phone Developer Registration" tool from your desktop.
       
  6. File > New > VB > Windows > Blank App (Windows Universal)
    1. To run on local machine: select Debug, then "x86", then "LocalMachine" in the debug toolbar.
    2. To run on emulator: select Debug, then "x86", then in the dropdown (that at first says "LocalMachine") pick Emulator.
    3. To run on your phone: connect by USB, then select Debug, then "ARM", then in the dropdown pick "Device"

 

 

Here are some exciting things about coding on VS2015 RC and Win10:

  • Edit and Continue now works! At least, it works on local machine and emulator. It doesn't yet work on ARM.
  • LINQ and lambdas can now be used in the Immediate and Watch windows!
  • There are some great new features in the VB language. My favorites are
    • string interpolation, e.g. Debug.WriteLine($"Point {pt} has length {pt.x:0.00}")
    • null-checking operator, e.g. Dim x As String? = customers.FirstOrDefault?.Name

 

Learning resources

Here's the basic "getting started" documentation on MSDN:

The first question you'll ask is: "If my app is supposed to be able to run windowed on desktop, and on tablets, and on phones, and on HoloLens, how should I design an adaptive-UI so it looks great on all of them?" This area is outside my expertise. Here are the training videos I've queued up but haven't yet got around to watching.

I'm also curious about how things will work on "Internet Of Things" devices.

 And there are a few more talks on my to-watch list: