- add: VC check

This commit is contained in:
2025-06-15 19:14:58 +03:00
parent 030f680b96
commit eb188321af
3 changed files with 33 additions and 1 deletions

View File

@@ -32,7 +32,6 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0"/>
<PackageReference Include="libsodium" Version="1.0.20"/>
<PackageReference Include="Robust.Natives" Version="0.1.1" />
<PackageReference Include="Robust.Natives.Cef" Version="131.3.5" />
</ItemGroup>
<ItemGroup>

View File

@@ -73,6 +73,12 @@ public partial class MainViewModel : ViewModelBase
PopupMessageService.OnCloseRequired += OnPopupCloseRequired;
CheckMigration();
if (!VCRuntimeDllChecker.AreVCRuntimeDllsPresent())
{
OnPopupRequired("VC runtime dlls are not present on this computer. Install VC runtime dlls.");
Helper.OpenBrowser("https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170");
}
}
private void CheckMigration()
@@ -209,4 +215,29 @@ public partial class MainViewModel : ViewModelBase
CurrentPopup = viewModelBase;
}
}
public static class VCRuntimeDllChecker
{
public static bool AreVCRuntimeDllsPresent()
{
if (!OperatingSystem.IsWindows()) return true;
string systemDir = Environment.SystemDirectory;
string[] requiredDlls = {
"msvcp140.dll",
"vcruntime140.dll"
};
foreach (var dll in requiredDlls)
{
var path = Path.Combine(systemDir, dll);
if (!File.Exists(path))
{
return false;
}
}
return true;
}
}