[GH-ISSUE #173] Unable to find the native Qml.Net library #108

Closed
opened 2026-05-05 11:05:12 -06:00 by gitea-mirror · 8 comments
Owner

Originally created by @bountifulellie on GitHub (Nov 18, 2019).
Original GitHub issue: https://github.com/qmlnet/qmlnet/issues/173

I got this error when trying to write up a basic program: Unable to find the native Qml.Net library. Try calling "RuntimeManager.DiscoverOrDownloadSuitableQtRuntime();" in Program.Main()

Here's the code I have:

using Qml.Net;
using Qml.Net.Runtimes;
using System;

namespace Desktop
{
    class Program
    {
        static void Main(string[] args)
        {
            RuntimeManager.DiscoverOrDownloadSuitableQtRuntime();

            QQuickStyle.SetStyle("Fusion");
        }
    }
}

As you can see, RuntimeManager.DiscoverOrDownloadSuitableQtRuntime() is called before the style is set. However it's still unable to find the native Qml.Net lib. What's going on?

Originally created by @bountifulellie on GitHub (Nov 18, 2019). Original GitHub issue: https://github.com/qmlnet/qmlnet/issues/173 I got this error when trying to write up a basic program: `Unable to find the native Qml.Net library. Try calling "RuntimeManager.DiscoverOrDownloadSuitableQtRuntime();" in Program.Main()` Here's the code I have: ```cs using Qml.Net; using Qml.Net.Runtimes; using System; namespace Desktop { class Program { static void Main(string[] args) { RuntimeManager.DiscoverOrDownloadSuitableQtRuntime(); QQuickStyle.SetStyle("Fusion"); } } } ``` As you can see, RuntimeManager.DiscoverOrDownloadSuitableQtRuntime() is called before the style is set. However it's still unable to find the native Qml.Net lib. What's going on?
Author
Owner

@pauldotknopf commented on GitHub (Nov 18, 2019):

After DiscoverOrDownloadSuitableQtRuntime, can you Console.WriteLine every environment variable?

<!-- gh-comment-id:555179896 --> @pauldotknopf commented on GitHub (Nov 18, 2019): After ```DiscoverOrDownloadSuitableQtRuntime```, can you ```Console.WriteLine``` every environment variable?
Author
Owner

@bountifulellie commented on GitHub (Nov 19, 2019):

Here (variables & values separated by colon):

HOMEPATH:\Users\lempamo
PUBLIC:C:\Users\Public
APPDATA:C:\Users\lempamo\AppData\Roaming
LOCALAPPDATA:C:\Users\lempamo\AppData\Local
sourcesdk:C:\Program Files (x86)\Steam\steamapps\common\SourceSDK
MAYA_SCRIPT_PATH:%VPROJECT%\..\sdktools\maya\scripts
SOAPY_SDR_ROOT:C:\Program Files\PothosSDR
QT_PLUGIN_PATH:C:\Users\lempamo\.qmlnet-qt-runtimes\qt-5.12.2-ad0689c-win-x64\qt\plugins
NEKO_INSTPATH:C:\HaxeToolkit\neko
XSI_VERSION:5.1
GYP_MSVS_VERSION:2015
ALLUSERSPROFILE:C:\ProgramData
PkgDefApplicationConfigFile:C:\Users\lempamo\AppData\Local\Microsoft\VisualStudio\16.0_2e26e6c9\devenv.exe.config
ProgramFiles(x86):C:\Program Files (x86)
TMP:C:\Users\lempamo\AppData\Local\Temp
MSBuildLoadMicrosoftTargetsReadOnly:true
OS:Windows_NT
VisualStudioDir:C:\Users\lempamo\Documents\Visual Studio 2019
USERNAME:lempamo
PROCESSOR_IDENTIFIER:Intel64 Family 6 Model 30 Stepping 5, GenuineIntel
ProgramData:C:\ProgramData
VOLK_PREFIX:C:\Program Files\PothosSDR
TUPI_SHARE:C:\Program Files (x86)\Tupi\data
KMP_DUPLICATE_LIB_OK:TRUE
DokanLibrary1:C:\Program Files\Dokan\Dokan Library-1.0.3\
LOGONSERVER:\\LEMON
VSSKUEDITION:Community
FPS_BROWSER_USER_PROFILE_STRING:Default
ChocolateyLastPathUpdate:Sat May 27 15:08:48 2017
CommonProgramW6432:C:\Program Files\Common Files
TUPI_PLUGIN:C:\Program Files (x86)\Tupi\plugins
PATHEXT:.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW;.RB;.RBW
asl.log:Destination=file
JAVA_HOME:C:\Program Files\Java\jdk1.8.0_131
VS140COMNTOOLS:C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\
COMPLUS_NoGuiFromShim:1
SESSIONNAME:Console
ServiceHubUniqueLogDir:566BFEBC
VisualStudioVersion:16.0
PROCESSOR_ARCHITECTURE:AMD64
VisualStudioEdition:Microsoft Visual Studio Community 2019
SystemRoot:C:\Windows
JD2_HOME:C:\Users\lempamo\AppData\Local\JDownloader 2.0
QML2_IMPORT_PATH:C:\Users\lempamo\.qmlnet-qt-runtimes\qt-5.12.2-ad0689c-win-x64\qt\qml
PROCESSOR_REVISION:1e05
TUPI_HOME:C:\Program Files (x86)\Tupi
MIC_LD_LIBRARY_PATH:C:\Program Files (x86)\Common Files\Intel\Shared Libraries\compiler\lib\mic
GRC_BLOCKS_PATH:C:\Program Files\PothosSDR\share\gnuradio\grc\blocks
VSAPPIDNAME:devenv.exe
HOMEDRIVE:C:
CommonProgramFiles:C:\Program Files\Common Files
USERPROFILE:C:\Users\lempamo
VSLANG:1033
windir:C:\Windows
DokanLibrary1_LibraryPath_x86:C:\Program Files\Dokan\Dokan Library-1.0.3\x86\lib\
ENABLE_XAML_DIAGNOSTICS_SOURCE_INFO:1
MEmu_Path:C:\Program Files (x86)\Microvirt
OneDrive:C:\Users\lempamo\OneDrive
INTEL_DEV_REDIST:C:\Program Files (x86)\Common Files\Intel\Shared Libraries\
GOROOT:C:\Go\
GR_PREFIX:C:\Program Files\PothosSDR
COMPUTERNAME:LEMON
OculusBase:C:\Program Files\Oculus\
RGSC:C:\Program Files (x86)\Rockstar Games\Rockstar Games Social Club\1_0_0_0
VSAPPIDDIR:C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\
Path:C:\Users\lempamo\.qmlnet-qt-runtimes\qt-5.12.2-ad0689c-win-x64\qt\bin;C:\ActiveTcl\bin;C:\ffmpeg\bin;C:\Rtools\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\Oculus\Support\oculus-runtime;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files\Python36\Scripts\;C:\Program Files\Python36\;C:\Python27\;C:\Python27\Scripts;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\dotnet\;C:\Program Files (x86)\Gource\cmd;C:\Users\lempamo\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\OpenVPN\bin;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\ProgramData\chocolatey\bin;C:\Go\bin;C:\Program Files\PuTTY\;C:\HaxeToolkit\haxe\;C:\HaxeToolkit\neko;C:\Program Files (x86)\GTK2-Runtime\bin;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\CMake\bin;C:\Program Files (x86)\Bazaar;C:\Program Files\Git\cmd;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\nodejs\;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Ruby26-x64\bin;C:\Users\lempamo\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\lempamo\AppData\Local\Turbo\Cmd\;%VPROJECT%\..\bin;C:\Program Files (x86)\FAHClient;C:\Users\lempamo\AppData\Local\GitHubDesktop\bin;C:\Users\lempamo\AppData\Local\Keybase\;C:\Users\lempamo\AppData\Roaming\npm;C:\Users\lempamo\.dotnet\tools
PSModulePath:C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
GTK_BASEPATH:C:\Program Files (x86)\GtkSharp\2.12\
ProgramFiles:C:\Program Files
ProgramW6432:C:\Program Files
ThreadedWaitDialogDpiContext:-2
NUMBER_OF_PROCESSORS:4
FSHARPINSTALLDIR:C:\Program Files (x86)\Microsoft SDKs\F#\10.1\Framework\v4.0\
DokanLibrary1_LibraryPath_x64:C:\Program Files\Dokan\Dokan Library-1.0.3\lib\
MKL_SERIAL:YES
PROCESSOR_LEVEL:6
ComSpec:C:\Windows\system32\cmd.exe
FPS_BROWSER_APP_PROFILE_STRING:Internet Explorer
HAXEPATH:C:\HaxeToolkit\haxe\
VBOX_MSI_INSTALL_PATH:C:\Program Files\Oracle\VirtualBox\
TEMP:C:\Users\lempamo\AppData\Local\Temp
SystemDrive:C:
RGSCLauncher:C:\Program Files (x86)\Rockstar Games\Rockstar Games Social Club
CommonProgramFiles(x86):C:\Program Files (x86)\Common Files
XSI_PLUGINS:%VPROJECT%\..\sdktools\xsi\5.1\valvesource
USERDOMAIN_ROAMINGPROFILE:LEMON
ChocolateyInstall:C:\ProgramData\chocolatey
USERDOMAIN:LEMON
POTHOS_ROOT:C:\Program Files\PothosSDR
UHD_PKG_PATH:C:\Program Files\PothosSDR
<!-- gh-comment-id:555309786 --> @bountifulellie commented on GitHub (Nov 19, 2019): Here (variables & values separated by colon): ``` HOMEPATH:\Users\lempamo PUBLIC:C:\Users\Public APPDATA:C:\Users\lempamo\AppData\Roaming LOCALAPPDATA:C:\Users\lempamo\AppData\Local sourcesdk:C:\Program Files (x86)\Steam\steamapps\common\SourceSDK MAYA_SCRIPT_PATH:%VPROJECT%\..\sdktools\maya\scripts SOAPY_SDR_ROOT:C:\Program Files\PothosSDR QT_PLUGIN_PATH:C:\Users\lempamo\.qmlnet-qt-runtimes\qt-5.12.2-ad0689c-win-x64\qt\plugins NEKO_INSTPATH:C:\HaxeToolkit\neko XSI_VERSION:5.1 GYP_MSVS_VERSION:2015 ALLUSERSPROFILE:C:\ProgramData PkgDefApplicationConfigFile:C:\Users\lempamo\AppData\Local\Microsoft\VisualStudio\16.0_2e26e6c9\devenv.exe.config ProgramFiles(x86):C:\Program Files (x86) TMP:C:\Users\lempamo\AppData\Local\Temp MSBuildLoadMicrosoftTargetsReadOnly:true OS:Windows_NT VisualStudioDir:C:\Users\lempamo\Documents\Visual Studio 2019 USERNAME:lempamo PROCESSOR_IDENTIFIER:Intel64 Family 6 Model 30 Stepping 5, GenuineIntel ProgramData:C:\ProgramData VOLK_PREFIX:C:\Program Files\PothosSDR TUPI_SHARE:C:\Program Files (x86)\Tupi\data KMP_DUPLICATE_LIB_OK:TRUE DokanLibrary1:C:\Program Files\Dokan\Dokan Library-1.0.3\ LOGONSERVER:\\LEMON VSSKUEDITION:Community FPS_BROWSER_USER_PROFILE_STRING:Default ChocolateyLastPathUpdate:Sat May 27 15:08:48 2017 CommonProgramW6432:C:\Program Files\Common Files TUPI_PLUGIN:C:\Program Files (x86)\Tupi\plugins PATHEXT:.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW;.RB;.RBW asl.log:Destination=file JAVA_HOME:C:\Program Files\Java\jdk1.8.0_131 VS140COMNTOOLS:C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\ COMPLUS_NoGuiFromShim:1 SESSIONNAME:Console ServiceHubUniqueLogDir:566BFEBC VisualStudioVersion:16.0 PROCESSOR_ARCHITECTURE:AMD64 VisualStudioEdition:Microsoft Visual Studio Community 2019 SystemRoot:C:\Windows JD2_HOME:C:\Users\lempamo\AppData\Local\JDownloader 2.0 QML2_IMPORT_PATH:C:\Users\lempamo\.qmlnet-qt-runtimes\qt-5.12.2-ad0689c-win-x64\qt\qml PROCESSOR_REVISION:1e05 TUPI_HOME:C:\Program Files (x86)\Tupi MIC_LD_LIBRARY_PATH:C:\Program Files (x86)\Common Files\Intel\Shared Libraries\compiler\lib\mic GRC_BLOCKS_PATH:C:\Program Files\PothosSDR\share\gnuradio\grc\blocks VSAPPIDNAME:devenv.exe HOMEDRIVE:C: CommonProgramFiles:C:\Program Files\Common Files USERPROFILE:C:\Users\lempamo VSLANG:1033 windir:C:\Windows DokanLibrary1_LibraryPath_x86:C:\Program Files\Dokan\Dokan Library-1.0.3\x86\lib\ ENABLE_XAML_DIAGNOSTICS_SOURCE_INFO:1 MEmu_Path:C:\Program Files (x86)\Microvirt OneDrive:C:\Users\lempamo\OneDrive INTEL_DEV_REDIST:C:\Program Files (x86)\Common Files\Intel\Shared Libraries\ GOROOT:C:\Go\ GR_PREFIX:C:\Program Files\PothosSDR COMPUTERNAME:LEMON OculusBase:C:\Program Files\Oculus\ RGSC:C:\Program Files (x86)\Rockstar Games\Rockstar Games Social Club\1_0_0_0 VSAPPIDDIR:C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\ Path:C:\Users\lempamo\.qmlnet-qt-runtimes\qt-5.12.2-ad0689c-win-x64\qt\bin;C:\ActiveTcl\bin;C:\ffmpeg\bin;C:\Rtools\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\Oculus\Support\oculus-runtime;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files\Python36\Scripts\;C:\Program Files\Python36\;C:\Python27\;C:\Python27\Scripts;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\dotnet\;C:\Program Files (x86)\Gource\cmd;C:\Users\lempamo\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\OpenVPN\bin;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\ProgramData\chocolatey\bin;C:\Go\bin;C:\Program Files\PuTTY\;C:\HaxeToolkit\haxe\;C:\HaxeToolkit\neko;C:\Program Files (x86)\GTK2-Runtime\bin;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\CMake\bin;C:\Program Files (x86)\Bazaar;C:\Program Files\Git\cmd;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\nodejs\;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Ruby26-x64\bin;C:\Users\lempamo\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\lempamo\AppData\Local\Turbo\Cmd\;%VPROJECT%\..\bin;C:\Program Files (x86)\FAHClient;C:\Users\lempamo\AppData\Local\GitHubDesktop\bin;C:\Users\lempamo\AppData\Local\Keybase\;C:\Users\lempamo\AppData\Roaming\npm;C:\Users\lempamo\.dotnet\tools PSModulePath:C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules GTK_BASEPATH:C:\Program Files (x86)\GtkSharp\2.12\ ProgramFiles:C:\Program Files ProgramW6432:C:\Program Files ThreadedWaitDialogDpiContext:-2 NUMBER_OF_PROCESSORS:4 FSHARPINSTALLDIR:C:\Program Files (x86)\Microsoft SDKs\F#\10.1\Framework\v4.0\ DokanLibrary1_LibraryPath_x64:C:\Program Files\Dokan\Dokan Library-1.0.3\lib\ MKL_SERIAL:YES PROCESSOR_LEVEL:6 ComSpec:C:\Windows\system32\cmd.exe FPS_BROWSER_APP_PROFILE_STRING:Internet Explorer HAXEPATH:C:\HaxeToolkit\haxe\ VBOX_MSI_INSTALL_PATH:C:\Program Files\Oracle\VirtualBox\ TEMP:C:\Users\lempamo\AppData\Local\Temp SystemDrive:C: RGSCLauncher:C:\Program Files (x86)\Rockstar Games\Rockstar Games Social Club CommonProgramFiles(x86):C:\Program Files (x86)\Common Files XSI_PLUGINS:%VPROJECT%\..\sdktools\xsi\5.1\valvesource USERDOMAIN_ROAMINGPROFILE:LEMON ChocolateyInstall:C:\ProgramData\chocolatey USERDOMAIN:LEMON POTHOS_ROOT:C:\Program Files\PothosSDR UHD_PKG_PATH:C:\Program Files\PothosSDR ```
Author
Owner

@pauldotknopf commented on GitHub (Nov 19, 2019):

It looks like it downloaded and loaded the Qt correctly at C:\Users\lempamo\.qmlnet-qt-runtimes\qt-5.12.2-ad0689c-win-x64.

Is this a 64bit machine?

My guess, there is some dependency/lib that Qt depends on that isn't on your machine.

I'd like to see if the .dlls are loaded into your app after running DiscoverOrDownloadSuitableQtRuntime. Add a Console.ReadLine() and use Process Hacker to list all the modules loaded in your app.

<!-- gh-comment-id:555310729 --> @pauldotknopf commented on GitHub (Nov 19, 2019): It looks like it downloaded and loaded the Qt correctly at ```C:\Users\lempamo\.qmlnet-qt-runtimes\qt-5.12.2-ad0689c-win-x64```. Is this a 64bit machine? My guess, there is some dependency/lib that Qt depends on that isn't on your machine. I'd like to see if the .dlls are loaded into your app after running ```DiscoverOrDownloadSuitableQtRuntime```. Add a ```Console.ReadLine()``` and use Process Hacker to list all the modules loaded in your app.
Author
Owner

@bountifulellie commented on GitHub (Nov 19, 2019):

Yes, it's 64-bit. Here are the modules that are attached to my app.
image

<!-- gh-comment-id:555311817 --> @bountifulellie commented on GitHub (Nov 19, 2019): Yes, it's 64-bit. Here are the modules that are attached to my app. ![image](https://user-images.githubusercontent.com/6828076/69113021-c9a5c580-0a4f-11ea-99ca-248ebfdbe2b2.png)
Author
Owner

@pauldotknopf commented on GitHub (Nov 19, 2019):

What does your csproj look like?

<!-- gh-comment-id:555314541 --> @pauldotknopf commented on GitHub (Nov 19, 2019): What does your csproj look like?
Author
Owner

@bountifulellie commented on GitHub (Nov 19, 2019):

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

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Qml.Net" Version="0.10.1" />
  </ItemGroup>

</Project>
<!-- gh-comment-id:555316532 --> @bountifulellie commented on GitHub (Nov 19, 2019): ```xml <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp3.0</TargetFramework> </PropertyGroup> <ItemGroup> <PackageReference Include="Qml.Net" Version="0.10.1" /> </ItemGroup> </Project> ```
Author
Owner

@pauldotknopf commented on GitHub (Nov 19, 2019):

Ah. You downloaded the Qt runtime, but you need the native Windows library which glues the runtime to .NET. Add a reference to Qml.Net.WindowsBinaries.

<!-- gh-comment-id:555316772 --> @pauldotknopf commented on GitHub (Nov 19, 2019): Ah. You downloaded the Qt runtime, but you need the native Windows library which glues the runtime to .NET. Add a reference to ```Qml.Net.WindowsBinaries```.
Author
Owner

@bountifulellie commented on GitHub (Nov 19, 2019):

Done, now it's fixed! Thanks

<!-- gh-comment-id:555317241 --> @bountifulellie commented on GitHub (Nov 19, 2019): Done, now it's fixed! Thanks
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/qmlnet#108
No description provided.