You can use Windows Subsystem for Linux (WSL) to run and develop the Linux editions of MDrivenServer and MDriven Turnkey from a Windows computer.
Choose your path
WSL is a Windows feature that runs a Linux distribution alongside Windows. Use it when you want a Linux-based MDriven environment while keeping Windows tools such as Visual Studio available.
| Goal | Use this section |
|---|---|
| Run the published Linux editions of MDrivenServer and Turnkey in WSL | #Run MDrivenServer and Turnkey in WSL |
| Build MDrivenServer from its source tree in WSL | #Build MDrivenServer from source |
| Set up a persistent Linux host with services and a reverse proxy | HowTos:Local Installation |
| Run a local container-based environment instead of installing the applications directly | Documentation:Running MDriven Locally with Docker |
Prepare WSL
Enable WSL and install Linux
- In Windows, open Turn Windows features on or off.
- Enable Windows Subsystem for Linux.
- Install a Linux distribution. The examples on this page use Ubuntu.
- Start the Ubuntu terminal and complete its initial user setup.
Your Windows C: drive is available in WSL at /mnt/c/. For example, the Windows folder C:\work\myproject is available as /mnt/c/work/myproject.
Use WSL 2 with Visual Studio
WSL 2 improves interaction between Visual Studio and WSL. To debug .NET applications in WSL 2 from Visual Studio, install the .Net Core Debugging with WSL 2 component:
- Open Visual Studio Installer.
- Select your Visual Studio edition and choose Modify.
- Open Individual components.
- Select .Net Core Debugging with WSL 2.
- Apply the changes.
Install the .NET SDK
MDrivenServer and Turnkey Linux distributions run with dotnet. Install a .NET SDK or runtime version that is compatible with the MDriven distribution you will run. The commands below show the Ubuntu package-repository setup used for Ubuntu 22.04:
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
Install the required SDK package after adding the repository. For example, the original source-build procedure used dotnet-sdk-5.0:
sudo apt-get install -y apt-transport-https
sudo apt-get update
sudo apt-get install -y dotnet-sdk-5.0
The published Linux deployment procedure states that the host needs at least .NET Core 3.1. Verify the runtime requirement for the distribution you download before choosing the package version.
Run MDrivenServer and Turnkey in WSL
Use this path to run the published Linux distributions. MDrivenServer must start before Turnkey because Turnkey connects to MDrivenServer.
Download and extract the applications
- Download the Linux distributions from the MDriven download site. The current Linux package names are listed under MDriven downloads.
- Create two separate directories. For example, use
~/mdriven/serverfor MDrivenServer and~/mdriven/turnkeyfor Turnkey. - Extract the MDrivenServer archive into the server directory.
- Extract the MDriven Turnkey archive into the turnkey directory.
The archives contain these application assemblies:
| Application | Assembly to start | Example port |
|---|---|---|
| MDrivenServer | AppCompleteGenericCore.dll
|
5010
|
| MDriven Turnkey | StreaminAppCoreWebApp.dll
|
5011
|
Configure Turnkey to find MDrivenServer
Before starting Turnkey, configure its MDrivenServerOverride.xml file so that it points to the MDrivenServer address and port you choose. The file is located in the Turnkey installation's App_Data directory.
For example, if MDrivenServer will run on port 5010, configure the override to use that server address and port. For a detailed configuration and service-based Linux installation, see HowTos:Local Installation.
Start the applications
- In the Ubuntu terminal, change to the MDrivenServer directory.
- Start MDrivenServer. This example exposes HTTP on port
5010:
dotnet AppCompleteGenericCore.dll -port=5010 -nohttps
- Keep MDrivenServer running, open another Ubuntu terminal, and change to the Turnkey directory.
- Start Turnkey on port
5011:
dotnet StreaminAppCoreWebApp.dll -port=5011 -nohttps
The -nohttps option uses HTTP. This avoids localhost certificate issues in this setup. Use the URLs that match the ports you selected.
First use
After MDrivenServer starts, open its chosen URL in a browser. The initial login described for this distribution is user a with password 123456.
A new MDrivenServer does not contain a model. Upload your model from MDriven Designer, then open the Turnkey URL to run the application.
Build MDrivenServer from source
Use this procedure only when you have the MDrivenServer source tree and need to build it in WSL.
Add the VistaDB NuGet source
The source build requires a NuGet package source for VistaDB packages that are not available on the public NuGet site. Add the source once, using the path to your local source tree. For a source tree located at C:\capableobjectswush, WSL sees the package folder at /mnt/c/capableobjectswush/Xternal/VistaDB.
sudo dotnet nuget add source /mnt/c/capableobjectswush/Xternal/VistaDB --name XternatVistaDB
Build and run
- Change to the directory that contains the solution file.
- Build the solution:
sudo dotnet build
- Change to the MDrivenServer project directory.
- Run the project. Replace
ip/domainwith the address or host name you intend to use:
sudo dotnet run -port=5001 -nohttps -host=ip/domain
When Visual Studio starts applications through WSL 2, command-line parameters may not be passed as expected. MDrivenServer checks the mdrivenserverport environment variable and uses it over HTTP when it is present. Turnkey uses the corresponding mdriventurnkeyport environment variable.
Publish a Linux build
.NET assemblies are platform-independent, but executable output is platform-specific. Publish separately for Linux when producing a Linux distribution:
dotnet publish -r linux-x64 --self-contained false
Troubleshoot
Bitmap or graphics errors
If the MDrivenServer WorkInfo page fails while creating bitmaps, install the graphics library and create the expected link:
sudo apt-get install libgdiplus
cd /usr/lib
sudo ln -s libgdiplus.so gdiplus.dll
Database compatibility when building from source
CompactCE is Windows-only. In the source-based WSL scenario, MDrivenServer can use VistaDB instead when the file App_Data/UseVistaDBIfThisFileExists.xml exists. CompactCE connection handling can fail in WSL because it reads the Windows registry.
Path and checksum differences
Windows paths use backslashes, while Linux paths use a different directory separator. Source code that handles paths must use Path.DirectorySeparatorChar rather than assuming a backslash.
Line endings can also differ: Windows commonly uses \r\n, while Linux uses \n. A model checksum created from text can differ between the platforms if it depends on those line endings.
