1
0

Added .NET version check

Added error handler
This commit is contained in:
Benjamin Höglinger-Stelzer 2018-10-25 13:20:52 +02:00
parent bb7d53110f
commit ab0ef80819
5 changed files with 70 additions and 13 deletions

View File

@ -1,6 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Handlebars" publicKeyToken="22225d0bf33cd661" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.9.5.0" newVersion="1.9.5.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows;
using ExceptionReporting;
using Microsoft.Win32;
namespace DerpingDrivers
{
@ -13,5 +9,38 @@ namespace DerpingDrivers
/// </summary>
public partial class App : Application
{
public App()
{
var netRelease = (int) Registry.GetValue(
@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full",
"Release",
0);
// This is a big ugly but catches cases where invoked without the app.config
if (netRelease < 394254)
{
MessageBox.Show(
"This program requires the .NET Framework v4.6.1 (or higher) to run properly, please install!",
"Missing .NET", MessageBoxButton.OK, MessageBoxImage.Error);
Shutdown(-1);
return;
}
DispatcherUnhandledException += (sender, args) =>
{
var er = new ExceptionReporter
{
Config =
{
AppName = "DerpingDrivers",
SendMethod = ReportSendMethod.None
}
};
er.Show(args.Exception);
args.Handled = true;
Shutdown(-2);
};
}
}
}

View File

@ -52,6 +52,15 @@
<Reference Include="Costura, Version=3.1.6.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
<HintPath>..\packages\Costura.Fody.3.1.6\lib\net46\Costura.dll</HintPath>
</Reference>
<Reference Include="DotNetZip, Version=1.11.0.0, Culture=neutral, PublicKeyToken=6583c7c814667745, processorArchitecture=MSIL">
<HintPath>..\packages\DotNetZip.1.11.0\lib\net20\DotNetZip.dll</HintPath>
</Reference>
<Reference Include="ExceptionReporter.NET, Version=4.0.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ExceptionReporter.4.0.2\lib\net40\ExceptionReporter.NET.dll</HintPath>
</Reference>
<Reference Include="Handlebars, Version=1.9.5.0, Culture=neutral, PublicKeyToken=22225d0bf33cd661, processorArchitecture=MSIL">
<HintPath>..\packages\Handlebars.Net.1.9.5\lib\net452\Handlebars.dll</HintPath>
</Reference>
<Reference Include="MahApps.Metro, Version=1.6.5.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.6.5\lib\net46\MahApps.Metro.dll</HintPath>
</Reference>
@ -70,8 +79,17 @@
<Reference Include="PInvoke.Windows.Core, Version=0.5.0.0, Culture=neutral, PublicKeyToken=9e300f9f87f04a7a, processorArchitecture=MSIL">
<HintPath>..\packages\PInvoke.Windows.Core.0.5.155\lib\net35\PInvoke.Windows.Core.dll</HintPath>
</Reference>
<Reference Include="SimpleMapi, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Simple-MAPI.NET.1.1.0\lib\net20\SimpleMapi.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Management" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\ControlzEx.3.0.2.4\lib\net45\System.Windows.Interactivity.dll</HintPath>
</Reference>

View File

@ -58,7 +58,6 @@
-->
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
@ -71,6 +70,5 @@
/>
</dependentAssembly>
</dependency>
-->
</assembly>

View File

@ -2,11 +2,15 @@
<packages>
<package id="ControlzEx" version="3.0.2.4" targetFramework="net461" />
<package id="Costura.Fody" version="3.1.6" targetFramework="net461" />
<package id="DotNetZip" version="1.11.0" targetFramework="net461" />
<package id="ExceptionReporter" version="4.0.2" targetFramework="net461" />
<package id="Fody" version="3.2.13" targetFramework="net461" developmentDependency="true" />
<package id="Handlebars.Net" version="1.9.5" targetFramework="net461" />
<package id="MahApps.Metro" version="1.6.5" targetFramework="net461" />
<package id="MahApps.Metro.IconPacks.FontAwesome" version="2.3.0" targetFramework="net461" />
<package id="Markdig" version="0.15.4" targetFramework="net461" />
<package id="Markdig.Wpf" version="0.2.5" targetFramework="net461" />
<package id="PInvoke.Kernel32" version="0.5.155" targetFramework="net461" />
<package id="PInvoke.Windows.Core" version="0.5.155" targetFramework="net461" />
<package id="Simple-MAPI.NET" version="1.1.0" targetFramework="net461" />
</packages>