前提・実現したいこと
VB.netでWebView2コントロールで指定したURLのページを
ブラウザ表示する簡単なテストプロジェクトを作成しています。
WebView2ランタイムは以下からダウンロードした固定バージョンのファイルを
https://developer.microsoft.com/ja-jp/microsoft-edge/webview2/
再配布できるようにこのようにプロジェクト内に配置しています。
WebView2テストプロジェクト内
1 2 ▷参照 3 ▷Microsoft.WebView2.FixedVersionRuntime.98.0.1108.62.x86 4 ▷Application.xaml 5 ▷MainWindow.xaml
以下のコードでデバッグ実行では問題なくWebView2ランタイムのファイルを読み込みブラウザ表示出来ます。
これをインストーラーを作成し、配布できるようにしようと考えていますが、
Visual Studioのソリューションエクスプローラーで
プロジェクトの【プロパティ】→【発行】→【今すぐ発行】からインストーラーを作成しようとすると、以下のようなエラー文が表示され、作成が失敗します。
また、なぜか一度インストーラー作成に失敗すると、通常のデバック実行でもエラーが出続けるという現象が発生しており、原因が分からずにいます。
なにか、考えうる原因について、ご教示いただければと思います。
該当のソースコード
Application.xaml
1<Application x:Class="Application" 2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 4 xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf" 5 xmlns:local="clr-namespace:WebView2" 6 StartupUri="MainWindow.xaml"> 7 <Application.Resources> 8 <wv2:CoreWebView2CreationProperties 9 x:Key="FixedWebView2CreationProperties" 10 BrowserExecutableFolder="Microsoft.WebView2.FixedVersionRuntime.98.0.1108.62.x86\" /> 11 </Application.Resources> 12</Application>
MainWindow.xaml
1<Window x:Class="MainWindow" 2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 4 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 5 xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf" 6 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 7 xmlns:local="clr-namespace:WebView2" 8 mc:Ignorable="d" 9 Title="MainWindow" Height="450" Width="800"> 10 <Grid> 11 <wv2:WebView2 CreationProperties="{StaticResource FixedWebView2CreationProperties}" 12 Source="https://www.google.com" /> 13 </Grid> 14</Window>
発生している問題・エラーメッセージ
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(3867,5): error MSB3113: ファイル 'msedge_elf.dll' が見つかりませんでした。
試したこと
① WebView2ランタイムのファイル指定を以下のように変更
Application.xaml.vb
1Imports Microsoft.Web.WebView2.Wpf 2Imports System.IO 3Imports System.Reflection 4 5Class Application 6 7 Protected Overrides Sub OnStartup(ByVal e As StartupEventArgs) 8 MyBase.OnStartup(e) 9 Dim executeDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) 10 Dim runtimePath = Path.Combine(executeDirectory, "Microsoft.WebView2.FixedVersionRuntime.98.0.1108.62.x86\") 11 Dim fixedWebView2CreationProperties = CType(Current.Resources("FixedWebView2CreationProperties"), CoreWebView2CreationProperties) 12 fixedWebView2CreationProperties.BrowserExecutableFolder = runtimePath 13 End Sub 14 15End Class 16
② bin、 obj、 packagesの削除
③ WebView2ランタイムのバージョンを変更
④ インストーラー作成時のアプリケーションファイルに該当のファイルが含まれているかを確認
補足情報(FW/ツールのバージョンなど)
Visual Studio2017
.NetFramework4.5
WPFアプリケーション

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。