Author name: admin

Build in Public

Building an Uno App for the Microsoft Store

I built my Calcumber app using Uno for to run as Web App and on Windows (and later for more). To bring Calcumber to the Microsoft Store, I was struggeling a lot. Now when I look back, everything looks managable, but when starting new with this topic, it was just walls of issues ahead of me. Therefore, I’d like to share my main learnings here with you. May it be of help for some coders out there!

Happy Coding

— Sam & Calcumber

Main Learnings

You don’t need an expensive code signing certificate for publishing your app via the Microsoft Store.

To register as a developer, you need a private Microsoft account (MSA), you cannot register using a work or school account (AAD, Azure Active Directory, Entra ID, …).

If logging in into the Microsoft developer account from Visual Studio does not work, changing settings make it work.

Your Store package is an unsigned package. You don’t need a key and you will not find it on your Microsoft Partner site.

Visual Studio Package Wizard does not work for Uno Projects with the Windows App SDK target. You build your packages using the msbuild command directly.$

You might also build for the Desktop (Windows, Linux, Mac using Skia) target instead of Windows App SDK. Then the Visual Studio packaging wizards should work.

Ensure your packages are fully self-contained.

Registering as Developer for Microsoft Store

Registering as a developer for Microsoft Store was a quite confusing procedure for me. First, you need to be aware of the two different kinds of Microsoft accounts:

MSA: personal Microsoft account

AAD: Azure Active Directory or Microsoft Entra ID or Work or School Accont

Registering as a developer only works with a personal MSA account, but the account can be later linked with the AAD account.

Registration as a company needs an official company registration document and cost a registration fee of $99 for companies.

Microsoft Learn Article: Steps to open a developer account

Creating an MSIX Package

Uno Articles

Build an unsigned packaged app

Build a signed packaged app

What is an MSIX package?

An MSIX package is a zipped package of all the files needed to run an application. The installation and uninstallation is automatically handeled by Windows. No admin rights are needed and uninstalling is 100% clean. This package format is accapted on the Microsoft store.

Connecting Visual Studio with the Developer Account

Building a package for the store should be easiest by logging into the developer account from Visual Studio. However, this did not work out of the box. I had to change the login configuration:

Tools ➔ Options ➔ Accounts

Add and reauthenticate accounts using:
System Web Browser (not Windows athentication broker)

Login via:

File ➔ Account Settings ➔ Add

Then it worked. Visual Studio can then fill the app details according to the store entry. Probably this could also be done by hand, and there is no key file needed for the store package.

Installing Windows 10 SDK

The Windows 10 SDK might be needed for building the package. And it containt the Windows App Cert Kit, which is recommended to run on the build package before uploading to the store.

I was installing Windows 10 SDK via the Visual Studio Installer, but the Windows App Cert Kit was missing at the end. So then I installed it via the official Installer. Finally, the Windows App Cert Kit is under C:\Program Files (x86)\Windows Kits\10\App Certification Kit\.

Preparing the Uno Manifest

Open Package.appxmanifest in the Desinger view.

Visual Assets Tab: use the generator to fill all necessary icon assets.

Packaging Tab:

Version Number: in the Designer View, you can only fill three part version number 1.0.0, but there is a four part version number 1.0.0.0 needed. Fill it manually in the source view F7.

Publisher: Choose Certificate… ➔ Create a certificate without password

Building the Package

For testing or deploying as direct download, a self-signed MSIX package is needed (unsigned packages cannot be installed).

For uploading to the store, you must build an unsigned package. The store will then sign it. This package you cannot install and test before uploading, so best is to create both packages based on exactly the same source.

Note on Dependencies

Store packages are supposed to be fully self-contained. That means, it does not depend on other packages, so you have to provide packages like .NET9.0 Runtime and WinAppRuntime, even if these are typically installed on Windows and used by many software packages. This makes your MSIX thick but reliable to run.

Theoretically a dependency of the WinAppRuntime could be defined in Package.appxmanifest and Microsoft Store could resolve it. But not for .NET9.0 since this is intendedly not in the store. So Store packages must provide it. Best practice is being fully self-contained.

Until I got it right with the self-contained package, I often got crashes when startin the application. Using the Event Viewer I got the information:

Faulting module name: Microsoft.UI.Xaml.dll

Faulting module name: CoreMessageingXP.dll

So, it is best to stay fully self-contained using in .csproj:

        <!– This includes the .NET runtime and  WinApp runtime –>

        <SelfContained>true</SelfContained>

        <WindowsAppSdkSelfContained>true</WindowsAppSdkSelfContained>

Self-Signed Package

The following build command I was using for publishing CalcumberUnoApp as self-signed test package. Adjust the input and output path and the TargetFramework as needed.

msbuild ./CalcumberUnoApp/CalcumberUnoApp.csproj `

/r `

/p:TargetFramework=net9.0-windows10.0.26100 `

/p:Configuration=Release `

/p:GenerateAppxPackageOnBuild=true `

/p:AppxBundle=Never `

/p:AppxPackageDir="../../Packages/" `

/p:UapAppxPackageBuildMode=Sideloading `

/p:AppxPackageSigningEnabled=true

Options explained:

OptionComment
/rrun nuget restore before
/p:TargetFramework=net9.0-windows10.0.26100 
/p:Configuration=Release 
/p:GenerateAppxPackageOnBuild=truecall the App Packaing targets after compiling
/p:AppxBundle=NeverOnly one architecture specific MSIX (…_x64.msix)
/p:AppxPackageDir=”../../Packages/” `   
/p:UapAppxPackageBuildMode=Sideloadingusing dev certificate
/p:AppxPackageSigningEnabled=trueturns on signing

Content of the target folder

AppName_1.0.0.0_x64Test/ 
AppName_1.0.0.0_x64 msixthe actual packge
AppName_1.0.0.0_x64.certhe certificate to be trusted for installation (Add to trusted people)
AppName_1.0.0.0_x64.msixsymDebug symbol package, needed for crash analytics
Add-AppDevPackage.ps1A PowerShell helper script that installs the test certificate into the current user’s store, and side-loads the MSIX.
Add-AppDevPackage.resources/Belongs to Add-AppDevPackage.ps1
Install.ps1A minimalist PS script that you can run if you don’t need the full interactive experience.
AppName_x64.appinstallerAn App Installer manifest: XML that tells Windows (or Edge) how to fetch and install your MSIX.
index.htmlA simple landing page that Uno generates alongside the AppInstaller. It gives users a one-click link (via the <a href=”*.appinstaller”> tag) to install your MSIX directly from the browser.

Installing

In Windows Explorer, double click the *.cer file. Install the certificate for Local Machine and place it in the Trusted People store.

Install the msix by double clicking.

Unsigned Store Package

For building the unsinged store package, just run the msbuild with different options. Here, the command used for Calcumber:

msbuild ./CalcumberUnoApp/CalcumberUnoApp.csproj `

/r `

/p:TargetFramework=net9.0-windows10.0.26100 `

/p:Configuration=Release `

/p:GenerateAppxPackageOnBuild=true `

/p:AppxBundle=Never `

/p:AppxPackageDir="../../Packages/" `

/p:UapAppxPackageBuildMode=StoreUpload `

/p:AppxPackageSigningEnabled=false

You cannot install the resulting msix. But you can run Windows App Cert Kit on it to see wether everything is right before uploading it to the store.

Store App Registration

App Capabilities:

Even if you just write a Hello World App in Uno that does not need any advanced System API call, Windows Desktop Apps are typically need full trust, especially Uno Apps. So you need to declare this and provide a privacy policy.

Examples

Potassium – Natural Body Radiation

Cristals of potash.
Potassium was first isolated from potash, a crystallized form of plant ash.

We don’t directly feel nuclear radiation, but it is present all around us — and even within us! Potassium ions are vital for  the functioning of all living cells, vegetables and fruits are good potassium sources. So if you are eating a healthy diet, you probably carry around 140 g of potassium. While most of the potassium atoms are stable, 0.012% is the active 40K isotope with a half-life of 1.24 billion years.

How many radio active potassium ions are in your body?

The avogadro constant describes how many atomes (or molecules) there are per mole of the substance. The constant is built-in to Calcumber as _NA.

The molecular weight of 40K is 40 g/mol.

Potassium in body: m_K = 140 g;

Of which radio active: m = m_K / 100 * 0.012 ➔ 0.0168 g

Number of atoms: n = m / (40 g/mol) * _NA ➔ 2.529e20

How many of decays pers second does this amount produce?

Decay rate (Activity): A = ln(2) * n / t_h ➔ 1.359e10 1/year

Calcumber automatically uses the input units, which is year. To get the result per second:

use s ➔ 427 1/s

There is quite some noise in us, isn’t there?

What energy dose is deposited in a 70 kg person?

Assumption: 1.3 MeV energy is deposited within our body per decay.

Decay energy: Q = 1.3 MeV;

Dose in a year: A * Q * 1 year / (70 kg) ➔ 4.0127e-5 Gy

use uGy ➔ 40.127 uGy

Is there a link between the high flammability and the radioactivity of potassium?

No, the reaction with oxygen is a chemical reaction while the other is a nuclear reaction.

Chemical: the electon arrangement of potassium and oxygen is changed to a lower level, emitting energy in the range of eV.

Nuclear: a neutron decays to an electron and a proton. As a result, the atom has one proton more and becomes 40Ca. The emitted energy is in the range of MeV, 1000 times higher compared to a chemical reaction. However the reaction rate of about 400 1/s is moderate, that’s why we don’t all spontaneously catch fire!

What is the average annual radiation dose we are exposed to (not only 40K)?

Interesting information you find on a page on Radiation Doses of the government of Canada. The dosis varies, it is something between 1 mSv and 12 mSv of natural dosis in an extreme case! An average is about 2 mSv.

Sievert is the radiation dose weighted by health impact. For the beta radiation of potassium, the weighting factor is 1. So the 40 µGy from the potassium in our body, the equivalent dose is 40 µSv, which is 2% of the average annual dose.

Calculation in Calcumber

Calculation of absorbed dose by self-irradation of potassium in human body.
Calculation of absorbed dose by self-irradation of potassium in human body.

Open this example in Calcumber Web App.

More on Potassium

Potassium in its metallic form is so soft, that you can cut it with a knife!

It reacts instantly with oxygen and water, often bursting into flames. It must therefore be stored under oil or vacuum.

The name comes from potash – the ash of plants from which it is first isolated.

Deriving the Activity Formula

Exponential decay with half-life t_h:

$$n(t) = n_0 2^{- \frac {t} {t_h}} = n_0 e^{ – { ln 2 } \frac {t} {t_h}} $$

Derived by time:

$$\dot{n}(t) = – n_0 \frac { \mathrm{ln 2} } { t_h } e^{ – \frac { \mathrm{ln 2} } { t_h } t} $$

$$\dot{n}(0) = – \frac {n_0} { t_h } \mathrm { ln 2 } $$

Activity:

$$A = – \dot {n}(0) = \frac {n_0} {t_h} ln 2$$

Links

Wikipedia: Potassium

Government of Canada: Radiation Doses

A great intro, sources of doses and numbers for yearly dose

Wikipedia: Sievert

About the equivalent dosis Sievert and how it relates to the absorbed dose Grey.

UK Government: Ionising radiation – dose comparisions

A great table of doeses for different exposures

Challenges

Potassium – Natural Body Radiation

Cristals of potash.
Potassium was first isolated from potash, a crystallized form of plant ash.

We don’t directly feel nuclear radiation, but it is present all around us — and even within us! Potassium ions are vital for  the functioning of all living cells, vegetables and fruits are good potassium sources. So if you are eating a healthy diet, you probably carry around 140 g of potassium. While most of the potassium atoms are stable, 0.012% is the active 40K isotope with a half-life of 1.24 billion years.

Challenge

How many radio active potassium ions are in your body?

How many of decays pers second does this amount produce?

What energy dose (in J/kg = Gy) is deposited in a 70 kg person? (Assume 1.3 MeV per decay)

More on Potassium

Potassium in its metallic form is so soft, that you can cut it with a knife!

It reacts instantly with oxygen and water, often bursting into flames. It must therefore be stored under oil or vacuum.

The name comes from potash – the ash of plants from which it is first isolated.

Stay curious

Is there a link between the high flammability and the radioactivity of potassium?

What is the average annual radiation dose we are exposed to (not only 40K)?

Links

Wikipedia: Potassium

Government of Canada: Radiation Doses

A great intro, sources of doses and numbers for yearly dose

Wikipedia: Sievert

About the equivalent dosis Sievert and how it relates to the absorbed dose Grey.

UK Government: Ionising radiation – dose comparisions

A great table of doeses for different exposures

Examples

Bike Gear

A bike computer showing a speed of 22.4 km/h and a cadence of 41 rpm.
The bike computer shows a speed of 22.4 km/h and a cadence of 41 rpm.

🚴‍♂️ How far do I go per pedal rotation?

Let’s calculate the distance per pedal rotation in the highest gear of this bike:

Speed = 22.4 km/h

Cadence = 41 1/min  (rpm)

Solution

Using Calcumber, it is a one-liner:

Input: 22.4 km/h / 41 1/min

Result: ~ 9.1 m

Why this works: Calcumber converts both values to the same units.

22.4 km/h; use m/s6.222 m/s

41 1/min; use s0.683 1/s

Now dividing the two values cancels out the unit second:

6.222 m/s / 0.683 1/s~ 9.1 m

🛠 Personal story:

I started investigating this after noticing my bike’s highest gear felt off — turns out, it really was getting lower over time.

The photo shows a replacement bike I used during repairs.
Measuring speed and cadence gave me insight into how much distance I actually cover with each pedal stroke.

– Sam and Calcumber

Challenges

Bike Gear

A bike computer showing a speed of 22.4 km/h and a cadence of 41 rpm.
A bike computer showing a speed of 22.4 km/h and a cadence of 41 rpm.

🚴‍♂️ How far do I go per pedal rotation?

Let’s calculate the distance per pedal rotation in the highest gear of this bike:

Speed = 22.4 km/h

Cadence = 41 1/min  (rpm)

Using Calcumber, it is a one-liner — but you can solve it by hand or by using any calculator.

💡 Love to see your solutions: on Twitter, Facebook or here.

🛠 Personal story:

I started investigating this after noticing my bike’s highest gear felt off — turns out, it really was getting lower over time.

The photo shows a replacement bike I used during repairs.
Measuring speed and cadence gave me insight into how much distance I actually cover with each pedal stroke.

– Sam and Calcumber

Scroll to Top