Development Platform

Download the latest free Visual Studio community edition from Microsoft.

When installing ensure the “Universal Windows Platform development” option is included.

Create A New Project

Menu > File > New Project

Visual C# > Blank App (Universal Windows)

Give the project and name and location and create it.

The version of Windows 10 to target it likely to be the most recent.

Once created, in the architecture dropdown select ‘ARM’.

Add “Windows IoT Extension for UWP” to the project

Right click on your project. Then, select Add > Reference..

Select Universal Windows > Exensions > Windows IoT Extension for the UWP, select the latest version and press OK

Setting App Capabilities

Open “Package.appxmanifest” and select the ‘Capabilities’ tab.

You need to select the items your app wants to use before you can use them.

Declaring App Links (Contracts) With Other Apps & Windows

Open “Package.appxmanifest” and select the ‘Declarations’ tab.

Contracts (declarations) enable your app to cooperate with another app, or Windows itself, to complete a well-defined task. Every contract has a source that initiates the task and a target that completes it. Your app can be the source for a contract without doing anything in the package manifest (it just makes various API calls).

The Project Files

App.xaml and App.xaml.cs. App.xaml

The application definition.  Its a special XAML file that doesn’t define any visuals, but rather defines an App class that can handle application-level tasks. Usually the only reason to touch this XAML file is to place new application-wide resources, such as custom styles, inside its Application.Resources collection.

Constructor – Effectively the app’s main method. The plumbing that makes it the app’s entry point is enabled by an “Entry point” setting in the package manifest (on the Application tab). When you create a project, Visual Studio automatically sets it to the namespace-qualified name of the project’s App class.

OnLaunched method – Enables the frame rate counter overlay in debug mode, navigates to the app’s first page, and calls Window.Current.Activate to dismiss the splash screen. If you want to add a new page and make it be the starting point of the app, or if you want to customize the initialization logic, this is where you can do it.

OnSuspending method – Attached to the base class’s Suspending event. This gives you an opportunity to save state before your app is suspended, although the generated code does nothing here other than provide a TODO comment.

MainPage.xaml and MainPage.xaml.cs

A new Blank App template project is given a single window with a single page called MainPage. It defines what the user sees once your app has loaded and the splash screen has gone away.

Things We Add To The Project & Default Class

App.xaml.cs Class Constructor
    sealed partial class App : Application
    {
		//---------------------------
		//----- PRIVATE DEFINES -----
		//---------------------------
		//private 

		//--------------------------
		//----- PUBLIC DEFINES -----
		//--------------------------
		//public 
	
		//---------------------------
		//----- PRIVATE OBJECTS -----
		//---------------------------
		//private 

	
		//--------------------------
		//----- PUBLIC OBJECTS -----
		//--------------------------
		//public 

		//*********************************
		//*********************************
		//********** CONSTRUCTOR **********
		//*********************************
		//*********************************
		/// <summary>
		/// Initializes the singleton application object.  This is the first line of authored code
		/// executed, and as such is the logical equivalent of main() or WinMain().
		/// </summary>
		public App()
        {
            this.InitializeComponent();
            this.Suspending += OnSuspending;
        }

		//*********************************
		//*********************************
		//********** ON LAUNCHED **********
		//*********************************
		//*********************************
		/// <summary>
		/// Invoked when the application is launched normally by the end user.  Other entry points
		/// will be used such as when the application is launched to open a specific file.
		/// </summary>
		/// <param name="e">Details about the launch request and process.</param>
		protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
Menu > Project > Add Class > Create ApMain.cs and set it up like this:
//*************************************
//*************************************
//********** VERSION HISTORY **********
//*************************************
//*************************************
//
//V1.00	##/##/##		Developer Name
//- Original release

//----- NEW VERSION CHECKLIST -----
//- Set MyProjectName > Properties > AssemblyInfo.cs > AssemblyFileVersion and AssemblyVersion


namespace MyProjectNamespaceName
{
    public static class ApMain      //<<<<< ADD 'public static' TO THIS CLASS TO MAKE IT GLOBAL (STATIC SO NO INSTANCES CAN BE CREATED OF IT) <<<<
    {
        //############################
        //############################
        //##### GLOBAL CONSTANTS #####
        //############################
        //############################
        //Use 'const' (no need for 'static' as const is static by nature)
        public const string MyGlobalString1 = "Hello1";
        public const int MyGlobalInt1 = 1;

	//##########################
	//##########################
	//##### GLOBAL OBJETCS #####
	//##########################
	//##########################
	//Use 'static' (all members inside a static class must also be static)
	//public static string MyGlobalString2 = "Hello2";

        //############################
        //############################
        //##### GLOBAL VARIABLES #####
        //############################
        //############################
        //Use 'static' (all members inside a static class must also be static)
        public static string MyGlobalString2 = "Hello2";
        public static int MyGlobalInt2 = 2;

        //Use them in your code like this:
        //SomeString = ApMain.MyGlobalString1;
        //SomeValue = ApMain.MyGlobalInt2;
    }

Configuring Visual Studio Application

Some settings we use to ensure trouble free build, deploy, run operation:

Tools > Options > Projects and Solutions > Build and Run

‘Only build startup projects and dependencies on run’ = unchecked

‘On Run, when project are out of date’ = Always build

Tools > Options > Text Editor > C# > Code Style > Formatting > General > Automatically format on paste=off

UK Electronic Designer
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.