UserGuide

Windows Universal Runtime

From Xojo Documentation

Microsoft refactored their core app runtimes in 2015. They have made what they call a "Universal C Runtime" which has been distributed via Windows Update to all supported versions of Windows that stay up-to-date (which is the default behavior for Windows Update).

Starting with Xojo 2016r1, the Xojo Windows framework has been updated to use the latest Microsoft tools. This allows Xojo to stay up to date and allow the Windows support to be improved in future releases. This means that Xojo now uses the new Univeral Runtime and your built apps now require it.

This Univeral Runtime is distinct from Universal Applications. Xojo still creates Win32 (WinAPI) apps for 32-bit and 64-bit apps.

As the Universal Runtime is distributed automatically via Windows Update and included with Windows 10, Microsoft considers it part of Windows. Because of this Xojo does not include the Universal Runtime DLLs when building Windows apps since most users will not need another copy.

If your users do not have the Universal Runtime, your apps will not run on their systems. The best solution is to make sure the user is up-to-date with Windows Updates. If that is not feasible, then you can also manually supply the Windows Universal Runtime.

Supplying the Windows Universal Runtime with your Apps

If your app is used with versions of Windows 7 or 8.1 that do not receive Windows Updates for some reason, you can choose to manually include the Universal Runtime. You can do this using the Visual C++ Redistributable for Visual Studio 2015 (which is what Microsoft recommends) or by manually including the 40 or so small DLLs alongside your app.

Using the Visual C++ Redistributable

Per Microsoft, this is the recommended way to provide the Universal Runtime.

To supply the Windows Universal Runtime on systems where it is not already installed, Microsoft recommends using the Visual C++ Redistributable for Visual Studio 2015. This redistributable is included with Xojo in the "Extras/Windows Runtime/Installers/" folder. Or you can download it directly from Microsoft: Visual C++ Redistributable for Visual Studio 2015. Additional updates to this redistributable may be available from Microsoft.

You include and use VC_redist.x64.exe for 64-bit apps or VC_redist.x86.exe for 32-bit apps.

These are the script additions to incorporate the redistributable into an Inno Setup installer script:

[Files]
Source: "VC_redist.x86.exe"; DestDir: {tmp}

[Run]
Filename: {tmp}\VC_redist.x86.exe; Parameters: "/install /quiet /norestart"
StatusMsg: "Installing 32-bit runtime..."; Flags: waituntilterminated


Other installers tools can incorporate this runtime in a similar manner.

When the Windows Universal Runtime is installed in this manner, further updates to it are handled automatically by the standard Windows Update mechanism.

Including the DLLs with your App

For situations where you don't use an installer but your app needs to run on machines without the Universal Runtime, you can include a local copy of the DLLs instead. In the Windows Build Settings you can turn the "Include Windows Runtime DLLs" property to ON (available on the "Advanced" (gear) tab of the Inspector). When you Run or Build with the property on, the 40 or so necessary Universal Runtime DLLs are copied alongside your app executable.

Additionally, when you turn this on a warning dialog appears to remind you that Windows Universal Runtime DLLs installed in the app folder do not get security updates. This is why Microsoft recommends installing the Universal Runtime by either Windows Update or the Visual C++ Redistributable when possible: further updates to it are handled automatically by the standard Windows Update mechanism.

Troubleshooting

If you get a DLL or framework error when trying to run your app, it usually means that the Windows Runtime is not installed on the computer. If this occurs, be sure to install the appropriate Visual C++ Redistributable. It also helps to make sure that you have also applied all Windows updates.

Windows Error Messages

  • "The program can't start because api-ms-win-crt-heap-l1-1-0.dll is missing from your computer. Try reinstalling the program to fix this problem."