Fixing installer for webview2 by frizzeling around with the right installation path

This commit is contained in:
Daniel Schick 2025-05-26 12:35:58 +02:00
parent 2576665c8d
commit c5222f3d51
5 changed files with 109 additions and 11 deletions

2
.gitignore vendored
View File

@ -159,7 +159,7 @@ MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
# *.manifest
*.spec
# Installer logs

View File

@ -8,12 +8,13 @@
<SignAssembly>True</SignAssembly>
<StartupObject>BreCalClient.App</StartupObject>
<AssemblyOriginatorKeyFile>..\..\misc\brecal.snk</AssemblyOriginatorKeyFile>
<AssemblyVersion>1.6.4.0</AssemblyVersion>
<FileVersion>1.6.4.0</FileVersion>
<AssemblyVersion>1.6.7.0</AssemblyVersion>
<FileVersion>1.6.7.0</FileVersion>
<Title>Bremen calling client</Title>
<Description>A Windows WPF client for the Bremen calling API.</Description>
<ApplicationIcon>containership.ico</ApplicationIcon>
<AssemblyName>BreCalClient</AssemblyName>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>

View File

@ -4,9 +4,11 @@
using BreCalClient.misc.Model;
using log4net;
using Microsoft.Web.WebView2.Core;
using Microsoft.Web.WebView2.Wpf;
using System;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
@ -561,18 +563,34 @@ namespace BreCalClient
};
string trenzUri = $"https://aismap.trenz.de/Live/StaticDemo.aspx?site=bsmd&Zoom=13&api=usgPcOPJnvTWUPTVbfVs&apikey=demo-H6cE4SG0FG&imo={this.ShipcallControlModel?.Ship?.Imo}";
await Dispatcher.InvokeAsync(() => {
string userDataFolder = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"BreCalClient", "WebView2");
await Dispatcher.InvokeAsync(async () => {
buttonPanel.Children.Add(popOutButton);
placeHolderMap.Children.Add(_webView);
_webView.CoreWebView2InitializationCompleted += (s, e) =>
{
if (!e.IsSuccess)
{
MessageBox.Show($"WebView2 initialization failed: {e.InitializationException.Message}");
return;
}
_webView.Source = new Uri(trenzUri);
};
try
{
_webView.EnsureCoreWebView2Async(null);
_webView.Source = new Uri(trenzUri);
var env = await CoreWebView2Environment.CreateAsync(null, userDataFolder);
await _webView.EnsureCoreWebView2Async(env);
}
catch(Exception ex)
{
MessageBox.Show($"WebView2 initialization failed: {ex.Message}");
MessageBox.Show($"EnsureCoreWebView2Async threw:: {ex.Message}");
}
});

View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Specifying requestedExecutionLevel element will disable file and registry virtualization.
Remove this element if your application requires this virtualization for backwards
compatibility.
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on
and is designed to work with. Uncomment the appropriate elements
and Windows will automatically select the most compatible environment. -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config.
Makes the application long-path aware. See https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
-->
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>

View File

@ -215,7 +215,7 @@
{
"AssemblyRegister" = "3:1"
"AssemblyIsInGAC" = "11:FALSE"
"AssemblyAsmDisplayName" = "8:BreCalClient.resources, Version=1.6.3.0, Culture=de, PublicKeyToken=9ce7b6b354e08ac9, processorArchitecture=MSIL"
"AssemblyAsmDisplayName" = "8:BreCalClient.resources, Version=1.6.5.0, Culture=de, PublicKeyToken=9ce7b6b354e08ac9, processorArchitecture=MSIL"
"ScatterAssemblies"
{
"_CD20A468610C42B89F66B4D3367A5A6A"
@ -329,15 +329,15 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:Bremen calling"
"ProductCode" = "8:{F6083A70-E7F6-4EB1-8448-2FF6D1245944}"
"PackageCode" = "8:{9A84EABA-1517-486A-B9BF-3854DD357267}"
"ProductCode" = "8:{89C43CE2-DE96-450E-92B3-834CD3A0C232}"
"PackageCode" = "8:{4D02DC1F-8E66-4F0B-B131-92462C33CC8A}"
"UpgradeCode" = "8:{1C7FA3E4-BAB9-4911-9348-73094357FC7C}"
"AspNetVersion" = "8:"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:FALSE"
"ProductVersion" = "8:1.6.4"
"ProductVersion" = "8:1.6.7"
"Manufacturer" = "8:Informatikbüro Daniel Schick"
"ARPHELPTELEPHONE" = "8:+49 (0) 421 - 38 48 27"
"ARPHELPLINK" = "8:https://www.bsmd.de/"