Running a Mono/.Net Windows binary/assembly

Hi, I’m trying to run a Windows binary, https://adressenprogrammapro.nl/ After 7z x adressenprogrammapro_7.0.8.0_release.msi, I get a bunch of .dll’s and a MAIN_EXE, which is of file type:

MAIN_EXE: PE32 executable (GUI) Intel 80386 Mono/.Net assembly, for MS Windows, 3 sections

With my limited/nonexistent knowledge of .Net, should I be using wine, dotnet or mono?

Wine

With Wine (even wineWowPackages.full), I do see a GUI, and it shows an error:

Message:
An error occured while creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object

Stacktrace:
  at APPro.UI.My.MyProject+MyForms.Create__Instance__[T] (T Instance) [0x000bf] in <332711aeebaf4669a2c8300d2bf7fc47>:0 
  at APPro.UI.My.MyProject+MyForms.get_FrmMain () [0x00000] in <332711aeebaf4669a2c8300d2bf7fc47>:0 
  at APPro.UI.My.MyApplication.OnCreateMainForm () [0x00006] in <332711aeebaf4669a2c8300d2bf7fc47>:0 
  at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun () [0x0000e] in <c27b6a0cdf0446ddb7b16e1ee39a8a98>:0 
  at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel () [0x00035] in <c27b6a0cdf0446ddb7b16e1ee39a8a98>:0 

… and a bunch of stuff on stdout/stderr, but none of which seems obviously problematic - happy to share if that’s useful.

mono

With mono, it complains it cannot find Microsoft.VisualBasic:

The entry point method could not be loaded due to Could not load file or assembly 'Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.

I can get a Microsoft.VisualBasic.dll with fetchNuGet, and when I place these in the current directory they do seem to get loaded, but just lead to further errors - happy to share them but doesn’t feel like I’m on the right track there.

dotnet

With various dotnet applications, like dotnetCorePackages.aspnetcore_7_0, it does seem to allow me to run binary assemblies, but I first have to rename MAIN_EXE to main.dll, and add a main.runtimeconfig.json like:

{
  "runtimeOptions": {
    "tfm": "netcoreapp3.1",
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "7.0.5"
    },
    "configProperties": {
      "System.Globalization.UseNls": true,
      "System.Net.DisableIPv6": true,
      "System.GC.Concurrent": false,
      "System.Threading.ThreadPool.MinThreads": 4,
      "System.Threading.ThreadPool.MaxThreads": 25
    }
  }
}

Unfortunately, that still leads to errors such as:

Unhandled exception. System.IO.FileLoadException: Could not load file or assembly 'Adressen Programma Pro, Version=7.0.8.0, Culture=neutral, PublicKeyToken=null'.
Aborted (core dumped)

what’s next?

Does anyone have recommendations on which approach should I pursue further?

I since learned this applications is based on .NET Framework 4.8 with WinForms.

Wine

Installing .Net Framework from WineHQ - .NET Framework 4.8 I still got an error:

Unhandled Exception:
System.NotImplementedException: The method or operation is not implemented.
  at System.Drawing.Font.FromLogFont (System.Object lf, System.IntPtr hdc) [0x0009e] in <993b785229084ceebbb252213aea31a1>:0 

Removing .NET Framework again (with wine uninstaller --list, wine uninstaller --remove "{...}") and installing dotnet40 with via winetricks seems to have gotten me a working application!

Now how to wrap this in a derivation - will read What is your approach to packaging Wine applications with Nix derivations? :slight_smile:

mono

Running Windows Forms on Linux with Mono and WinForms | Mono do give some cause for optimism that this could work after all