Partager via


Tips and Tricks for Raspberry Pi 2, Windows 10 IoT Core, Visual Studio 2015 and GitHub

Here are some tips and tricks that I learnt the hard way to maintain "round trip" project state for a Raspberry Pi 2 Windows 10 IoT Core project on GitHub. Hopefully it'll give you back the hours I lost sorting this out.

 

A bit of context, I maintain the "Maker Den" Windows 10 IoT Core Raspberry Pi 2 project on GitHub, it's designed to be an accessible IoT framework and maker experience. One of my key requirements is when the project is downloaded or cloned from GitHub it is in the exact state I saved in it so it just works when a user opens it in Visual Studio 2015. No fiddling with the processor architecture, no setting up the remote device name etc.

 

I needed the project to remember

  1. It's targeting the ARM processor architecture
  2. It's targeting a remote device – namely the default "minwinpc" Windows 10 IoT Core computer name.
  3. What references and frameworks the project uses.

 

Targeting ARM Architecture

This information is held in the solution root (hidden) directory " .vs" in a file named " .suo"

Remote Device Name

This information is stored in the "StartUp Project" folder in a file that matches your project file name with the " .user" extension. Take a look in this xml file and you'll see the remote device name.

Project References and Frameworks

This information is held in the "project.lock.json" file, it's information about the target SDK and references. See https://docs.asp.net/en/latest/dnx/overview.html and https://blog.brunomlopes.com/2015/07/should-i-put-projectlockjson-in-source.html for more information.

 

How to Fix

The default Visual Studio GitHub " .gitignore" file is your frenemy and this is where you need to be better acquainted.

  1. Open up the project " .gitignore" file in the text editor of your choice
  2. Search for and comment out the following ignore types with a # at the beginning of each of these lines
    1. *.suo
    2. *.user
    3. .vs/
    4. project.lock.json
    5. .pfx
  3. Save the changes
  4. Open the git command prompt in the root of your solution and using the "Git add .vs/* " command add the contents of the .vs/ to the local git repository
  5. Now do a git push or sync to ship these files up on to GitHub.
  6. Test by downloading/cloning and building the project from GitHub, hey presto, all your project settings should now be in place just as you wanted:)

 

Cheers Dave