Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit a486524f authored by Michael KRISPER's avatar Michael KRISPER
Browse files

[VECTOStart] Added VECTO Project for starting VECTO GUI in the newest .net version

parent 879e5730
No related tags found
No related merge requests found
......@@ -68,6 +68,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VectoAPI", "..\VECTO-API\Ve
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VectoAPI Test", "..\VECTO-API\VectoAPI Test\VectoAPI Test.csproj", "{D959CB7C-F514-4F5E-9C33-684D0012474B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VECTOStart", "VECTOStart\VECTOStart.csproj", "{A151C75E-471A-42EB-8FE2-296C8D9FB8F9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -220,6 +222,12 @@ Global
{D959CB7C-F514-4F5E-9C33-684D0012474B}.Deploy|Any CPU.Build.0 = Debug|Any CPU
{D959CB7C-F514-4F5E-9C33-684D0012474B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D959CB7C-F514-4F5E-9C33-684D0012474B}.Release|Any CPU.Build.0 = Release|Any CPU
{A151C75E-471A-42EB-8FE2-296C8D9FB8F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A151C75E-471A-42EB-8FE2-296C8D9FB8F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A151C75E-471A-42EB-8FE2-296C8D9FB8F9}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU
{A151C75E-471A-42EB-8FE2-296C8D9FB8F9}.Deploy|Any CPU.Build.0 = Debug|Any CPU
{A151C75E-471A-42EB-8FE2-296C8D9FB8F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A151C75E-471A-42EB-8FE2-296C8D9FB8F9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
VECTOStart/Icon2.ico

4.19 KiB

using System;
using Microsoft.Win32;
using System.Diagnostics;
namespace TUGraz.VECTO
{
class Program
{
static void Main()
{
var version = GetHighestNETVersion();
try {
Process.Start(new ProcessStartInfo($"{version}\\VECTO.exe") { CreateNoWindow = true });
} catch (Exception e) {
Console.WriteLine($"Could not start VECTO with {version}: {e.Message}");
Console.ReadKey();
}
}
private static string GetHighestNETVersion()
{
if (SupportsNet50()) {
return "net5.0";
}
if (SupportsNET48()) {
return "net48";
}
return "net45";
}
private static bool SupportsNet50()
{
var p = Process.Start(new ProcessStartInfo("dotnet", "--list-runtimes") {
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardOutput = true
}
);
p.WaitForExit();
var output = p.StandardOutput.ReadToEnd();
return output.Contains("Microsoft.WindowsDesktop.App 5.0");
}
private static bool SupportsNET48()
{
const string subkey = @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\";
using (var ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(subkey)) {
if (ndpKey != null && ndpKey.GetValue("Release") != null) {
var releaseKey = (int)ndpKey.GetValue("Release");
return releaseKey >= 528040;
}
return false;
}
}
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks />
<TargetFramework>net45</TargetFramework>
<AssemblyName>VECTO</AssemblyName>
<ApplicationIcon>Icon2.ico</ApplicationIcon>
<PackageIconUrl />
<RootNamespace>TUGraz.VECTO</RootNamespace>
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants />
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<None Include="..\VECTO\Resources\Icon.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>
</Project>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment