Windows IoT Core – How to Clone & Repair Your RPI3 SD Cards With Windows

July 24, 2018

A while ago I managed to corrupt my SD card that was holding my Windows IoT Core and all the apps running Sad smile

I lost some of my work and had to redo a brand new installation on a new SD card !

So I went to look on how to prevent this from happening in the future.


Download the Win32 Imager from Sourceforge


Cloning the SD Card With Windows

1. Install the application

2. Make an image to your local machine


Wait for the imaging of the SD card to be completed. There is a progress bar that will give you an idea as to how long this will take.

Done !

Restoring an SD Card From a Clone

Clean you SD card first to regain all the capacity :

1. First format the DS Card


2. Next regain all the unallocated space using these steps :

Open cmd prompt with Admin priviliges and run these commands :



=>  SELECT DISK 1 (if this is your SD Card !)




To zero out all data on the SD card you could use “clean all” instead



Check again using the Disk Manager you should now have all the capacity back Winking smile


If this did not work best check the alternatives here :

Restore using Win32 Imager

Select the previously saved image and press WRITE



Watch the progress bar and check the result …


Windows Core IoT – Stop Cortana process

July 21, 2018

When running the latest version of Windows IoT, it will install the Cortana service as well …

Which can take quite some unnecessary memory and CPU from your little RPI3 Sad smile

This way you can find out how to stop it manually, because there is no way you can do it at boot time ?

When starting Windows IoT you can see the Cortana process is running :


If you select STOP you notice it doesn’t stop from the first time ?

You need to repeat it multiple times….

Uninstalling did not work, IoT crashed afterwards and stopped working.

Let’s see if we can find a different way ?

We will make use of some command line tools, see here :

First lets list all processes using TLIST.EXE


You will notice you won’t find anything related to Cortana at first sight…

Let’s run TLIST.EXE –v


Just like to the full Windows 10 you find out that SearchUI.exe is hosting the Cortana process.

Let’s try to kill it now using the KILL.EXE command :


Using the Process ID or the Process Name …

Indeed the process stopped immediately.


I noticed that after a while the process starts again automatically ?

So now we can quickly kill it again when needed.

Enjoy !

Windows Core IoT – Wifi Issues on a RPI3

July 14, 2018

After I upgrade Windows IoT on my RPI3 to a later version….

I had 2 major issues Sad smile

1. After Upgrading Windows IoT was not booting

   Because of a failed upgrade …

   And my SD card got in a Locked state … This means I could not even format it anymore

   Tried every trick in the book (even formatting using a smartphone) but no success.

   The SD card was down the drain.

    Later on I will write an article on how to make an image of your Windows Core IoT…

    So you don’t loose all your work Winking smile

2. WIFI got very unstable

    After starting with a new Windows Core IoT installation,  it got connected but then lost connection.

    Very annoying !

    The build I was using was v.10.0.17134.

After searching the internet I found many more users experiencing…


One solution / workaround I found was this :

1. Connect your RPI3 using a network cable and start Windows Core IoT

2. next go to the Web Portal interface using your IP:8080

3. Delete You WIFI Profile, and create a new one and save it again.


If not stable repeat this again …

If still you experience problems investigate the WIFI Device Error Code here :

Go to Devices

-> ACPI ARM-based PC

-> Microsoft ACPI-Compliant System

-> Broadcom 2836 Arasan SD Host Controller

-> Broadcom 802.11n Wireless SDIO Adapter



If you see code 23 or 24 your SD card is not OK Sad smile Try a faster SD card Type.

Mine was OK but still WIFI issues …

So again I tried to install the latest Windows updates (but first made an image of my prior installation)


Now I am on version 10.0.17134.165


And all is running stable again Smile

You can check the WIFI performance like this …

netsh wlan show interfaces


As you know the RPI3 B model has weak WIFI throughput compared to the new B+  Model.

But unfortunately there is no Windows Core IoT driver available yet ? Sad smile

Enjoy !

Windows Core IoT – ASP DotNet Core Razor Pages & SQLite & Web Service on a Raspberry PI3

May 28, 2018

Building a Web Server App using ASP .Net Core using a SQLite Database and a Web Service starts here using this example.

I gave it a little twist in order to get it to use an SQLite Database and add a Web Service to it.

This means you need to follow page 1 of 8 from this Tutorial to get the full deal. I only did page 1 & 2.

But make the necessary change mentioned below.

Keep in mind that the we will only use the command line options, and no bulk load of software needed to install Smile

Requirements are that you have Dotnet Core installed.

And have the DB using EF Tools installed from NuGet

Creating the  .Net Razor App

1. Create a new blank RAZOR project

Create a new folder in your PC and run the command to create a new RAZOR project


Command : dotnet New Razor

This will create a new blank Razor project

2. Install the DB using EF Tools

Go to Nuget and look for this package


I used the version 2.1.0-rc1-final

Run this command :

dotnet add package Microsoft.EntityFrameworkCore.Tools –version 2.1.0-rc1-final

After installation you can test is using this command :

dotnet ef


3. Add more packages needed

dotnet add package Microsoft.EntityFrameworkCore.Tools.DotNet –version 2.1.0-preview1-final

dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design –Version 2.0.0

dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Utils –Version 2.0.0

4. Add missing other packages

Correct the project .Json package references, by adding the missing packages from the Nuget Site :


<Project Sdk="Microsoft.NET.Sdk.Web">
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.2" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Utils" Version="2.1.0-preview2-final" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.1.0-preview1-final" />
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
    <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.8.0" />
    <PackageReference Include="SQLitePCLRaw.bundle_green" Version="1.1.10" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.0.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.0.2" />
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.4" />
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />

Next run this command :

dotnet add xxxxx form the .NET CLI command.


It downloads and installed the package selected on the NuGet site

Check you .Json Project file again afterward and continue with the rest of the missing packages

When finished run command :

dotnet Restore

5. Add the missing code to generate the DB

(Or generate the code based on an existing DB using Scaffolding)

Example : Create a Models folder. In the Models folder, create a class file named Student.cs

Content see example Microsoft site :


6. Create the xxxxContext DB context

xxx = School in my case


In the Data folder create SchoolContext.cs


This is where I modified the code to use SQLite instead of a Local DB


In Startup.cs add the missing references (Using xxx) add the DB Context reference :


Add the DB Context reference :

services.AddEntityFrameworkSqlite().AddDbContext<SchoolContext>(); // Added

In the Data folder, create a new class file named DbInitializer.cs see MS Example Site


Which gets called by program.cs


This will create the Database Tables, Fields and Records using the Entity Framework Tools.

Opposite, you can create View Pages from an existing Database using Scaffolding with the Entity Framework Tools too… Winking smile

Use a command like this to generate an EF Model from and existing Database

dotnet ef dbcontext scaffold “Datasource=C:\CoreIoT\ASPSQLite\Nwind.db” Microsoft.EntityFrameworkCore.Sqlite -o Models -c “DatabaseContext” –f

7. Generate the View pages based on the model you created before :

Courses : dotnet aspnet-codegenerator razorpage -m Course -dc SchoolContext -udl -outDir Pages\Courses –referenceScriptLibraries

Instructor : dotnet aspnet-codegenerator razorpage -m Instructor -dc SchoolContext -udl -outDir Pages\Instructors –referenceScriptLibraries

8. Correct the ERRORS, if needed…

When running the command in step 6 you can get ERRORS.


Globally change _context.Student to _context.Students (add an “s” to Student)


Quote from MS Site :

There are 7 occurrences found and updated. This is a bug and the hope to fix this bug in the next release.

=> TEST THE APP to see all errors are gone :


cd to your project folder, next use this command :

Dotnet Run

9. BEFORE publishing add the following string in the program.cs and republish again.



10. Publish for RPI3 – ARM

Run this command : dotnet publish -r win8-arm

11. Copy from Publish to your RPI3

Copy the Files from the PUBLISH folder to your RPI3.

ASPRazor -> C:\CoreIoT\ASPnetRazorSQLiteWsAPI\bin\Debug\netcoreapp2.0\win8-arm\publish\


Next MAKE SURE your FOLDER STRUCTURE on the RPI3, is exactly the same as it was on your PC before Publishing.


Or you run into this error : ‘Unable to open database file’

Next COPY the SQLite Database to your RPI3. Because this is NOT included when publishing using DotNet Core to win8Arm

12. Test the .Net Razor App on your RPI3

Login using PowerShell WSMAN to your RPI and start the app.


Go to the URL (it can take a while before all is loaded ….)


Let access the database ?


Let’s add some data ?



Haleluja, this is fully functional and cross platform !!

Adding a Web Service to the .Net Razor App

Next I will add it to the site to see we can access the data using a Web Service API.

Again instead of using the full blown Visual Studio we will only use the command line options.

Because we don’t want to install an elephant weight of software !


Actually Visual Studio uses all these commands in the background too … Winking smile

Run this command :

dotnet aspnet-codegenerator controller -api -name StudentAPIController -m Student -dc SchoolContext -udl -outDir Models\API –referenceScriptLibraries -f


see the result


You also have the option to generate XML instead of JSON


Check the result !!


This is how you you select ID 5

ID = 5


It contains GET / POST / PUT / DELETE methods !

Accessing the Web Service using PowerShell



$URL = "http://localhost:5000/api/StudentAPI"

$APIService = Invoke-RestMethod -Uri $URL

$APIService | select ID, lastName, firstMidName 

After copying to your RPI3 you can change the URL to http://rpi3:5000/api/StudentAPI

And test it …


As you can see all runs fine, no Visual Studio needed …. Smile

So now you have a Web Service running on your RPI3, who could have imagined this … ?

Use Case :

Since you now have an SQLite DB running your can feed it with your RPI3 SENSOR data and read it out using the Web Smile

or even as a Web Service as demonstrated above …

Enjoy !

Windows Core IoT – ASP DotNet Core Razor Pages on a Raspberry PI3

April 20, 2018

Continuing on based on my prior posts

.Net Core on RPI3

SQLite on RPI3

I am going to explain how to use Windows IoT and ASP .Net Core on a RPI3.

As of version 2.0 we now can create ASP Razor webpages in .NET Core.

Remember that in the past I made some post about Web Matrix

That is in fact the predecessor of ASP .Net Core. Read more here

How to use Razor Pages in ASP.NET Core 2.0

Start with installing the DotNet Core Template to begin with

Run command :

dotnet new Razor -n ASPnetCoreRazor -o C:\CoreIoT\ASPnetCoreRazor


Next Run the Template Application on your Windows PC.

Use command :

cd C:\CoreIoT\ASPnetCoreRazor

dotnet Run


Voila as simple as that Smile


Next Publish it for Windows IoT on a RPI3 Architecture

Run command :

dotnet publish -r win8-arm


Copy the files to your RPI3 from C:\CoreIoT\ASPnetCoreRazor\bin\Debug\netcoreapp2.0\win8-arm\publish


Connect to RPI3 using PowerShell remote session and start the ASPNetCoreRazor.exe Application


No connection … ? Sad smile



1. You need to open the Firewall Port 5000 on your RPI3 first.

Run command :

netsh advfirewall firewall add rule name=” ASPnetCoreRazor ” dir=in action=allow protocol=TCP localport=5000


2. Modify the Template Program.cs script

And add this line : .UseUrls(http://*:5000)


Publish again :

dotnet publish -r win8-arm


Copy the files back over to your RPI3 :


Next connect to RPI3 using PowerShell and start the app ….



Open the browser and go to : http://rpi3:5000


It runs as expected !! Smile

So now we know how to create RAZOR pages, the door is open to start experimenting with the RAZOR syntax.

As well as integrating SQLite database using the ASP .NetCore Razor Front End….

Enjoy !

Windows Core IoT – SQLite on a Raspberry PI3

April 15, 2018

As shown in the previous post you can run use Dotnet Core to compile apps for Windows IoT on a RPI3

See here how to get started with Dotnet Core

On the net you can find how to use Dotnet Core and SQLite :

But the example uses the Dotnet Core v1.0 Framework and run on Windows.

I will show here how to use the latest Dotnet Core v2.0 Framework and publish it for Windows ARM on RPI3 Winking smile

Run command Dotnet new console –n Sqlite –o C:\DotNetCoreApps\Sqlite

And check the result here :


Copy the program.cs as backup, and copy the program code from the site above into the program.cs file.

Change the namespace to SQLite (see-n SQLite in first command)


Change the sqlite.csproj file content by adding a few lines


Add these line :


<Project Sdk=”Microsoft.NET.Sdk”>

<PackageReference Include=”Microsoft.EntityFrameworkCore.Sqlite” Version=”2.0.2″ />
<PackageReference Include=”SQLitePCLRaw.bundle_green” Version=”1.1.10″ />

     <DotNetCliToolReference Include=”Microsoft.EntityFrameworkCore.Tools.DotNet” Version=”2.0.0″ />

Run command : dotnet Restore


As you can see it will use some Nuget packages as included in the sqlite.csproj file

Next run this command : dotnet publish -r win8-arm

And copy the files to your RPI3


Next open PowerShell do a remote session and run the .\SQLite.exe


When the SQLite DB doesn’t exist yet, it will be created automatically.


DotNet Core is really a cross-platform language !

It runs flawlessly on a RPI3 – ARM Architecture, by just re-using the same code base we use on a Windows machine Smile

See here for more info on .NET Core Data Access data sources :

Enjoy !

Windows Core IoT – DotNet Core on a Raspberry PI3

April 15, 2018

Before we can start creating a project using .NET Core for RPI3, we first need to explain what and why we use .NET CORE !

.NET Core supports three app models:

  • ASP.NET apps and services
  • Console apps
  • Universal Windows Platform (UWP) apps

First of all .Net CORE is a Cross-Platform Framework opposed to the regular .Net Framework.

Supporting the following platforms:

  • Windows
  • OS X
  • Linux

Read more about .Net Frameworks here


More info you can find here and here


Since RPI3 runs on an ARM architecture we can’t just use Standard .Net Assemblies to build projects…

You can now easily convert a platform-specific class library into a portable class library by publishing to another platform.


I will show you an example as we go along.


Getting Started

As being a scripter I hate to install all the overhead on my PC just to do simple things !

That’s why will only use the Command Line Interface (CLI) and NO Visual Studio Smile


Prerequisites :

We first have to install the .Net Core SDK on you desktop PC.

At the moment MS has arrived at .Net Core SDK version 2.1.103, Download here



This is all you need to do a quick start Smile


Once installed open the Command Prompt and let’s check the version installed.

Run command : dotnet /? to get all options.


To get the version info we run the command:

dotnet –version or even better is dotnet –info


.Net Core Extensions

In contrast to the .NET Framework, the .NET Core platform will be delivered as a set of NuGet packages.

These extension are needed to build your applications. We will come back to this later on showing the examples…





You can download packages manually from the Nuget Site and open them using 7-zip.

And extract the libraries you need for your environment…


As mentioned before instead of using Visual Studio to start our for project.


We will just use the DotNet Core Command line Tools, to build the first Console App in .Net Core for RPI3.

.Net Core has the same Template Apps as you can get through Visual Studio, let’s see what is available.

Run command : dotnet new


Also RAZOR pages are possible as you can see Smile


.Net Core Console App

1. Console app Template :


Run command : dotnet new console

optional parameters are :

–n specifies the name of the project

-o specifies the output location, if omitted it will create the project in the %userprofile%  dir.

dotnet new console -n MyFirstCoreApp -o c:\coreiot



The Template app has generated this code



2. Run the console app.

cd c:\coreiot

Dotnet run

dotnet publish -r win8-arm



3. Publish to RPI3

In order to use it on RPI3 or Linux we need to add a few lines in the MyFirstCoreApp.csproj file




Remember the RuntimeFrameworkVersion you can find in the .Net Core Info see

See dotnet –Info

Next run the dotnet restore command


Next run the dotnet publish -r win8-arm command


or if you focus a Linux distribution you run the command

dotnet publish -r ubuntu.16.04-arm


4. Copy the app to the RPI3




5. Using PowerShell to run it

cd to your app folder



Runs as expected Smile


6. Change the code using an input parameter




Console.WriteLine(“\nWhat is your name? “);
var name = Console.ReadLine();
var date = DateTime.Now;
Console.WriteLine($”\nHello, {name}, on {date:d} at {date:t}!”);
Console.Write(“\nPress any key to exit…”);


Run command : dotnet run



Next run command : dotnet publish -r win8-arm


And copy it back to RPI3 and test it using PowerShell


Next see here for an SQLite Example on RPI3

Next see here for an ASP .Net Core Example on RPI3


PS :

Keep in mind that for Windows there is a nice Extension Library.

That gives you access to about 20.000 Windows API’s

Run this command to add it to your project

dotnet add package Microsoft.Windows.Compatibility –version 2.0.0

Enjoy !