使用CEFSharp Web浏览器中的ClickOnce发布崩溃WPF应用程序 [英] WPF application using CEFSharp Web Browser crashing in clickonce release
问题描述
我有一个简单的WPF应用程序,它工作在调试正常,但当我做的ClickOnce发布其崩溃试图加载CEFSharp网页浏览器时,
我有一个登录页面,用户点击,然后打开的浏览器一旦点击我碰到下面的错误
型
未处理的异常'System.Windows .Markup.XamlParseException'发生在
PresentationFramework.dll
其他资料:类型
构造函数的调用MyProject.Views.CefSharpWebBrowserUserControl相匹配的
指定绑定约束抛出了一个异常
块引用>
> < TabItem的标题=网页NAME =CefWebPage>
> <网格背景=#FFE5E5E5保证金=0>
> < Grid.ColumnDefinitions>
> < ColumnDefinition WIDTH =871 */>
> < /Grid.ColumnDefinitions>
> <访问量:CefSharpWebBrowserUserControl X:NAME =CefSharpWebBrowserUserControl>< /浏览次数:CefSharpWebBrowserUserControl>
> < /网格和GT;
> < / TabItem的>
例外:无法创建CefSharpWebBrowserUserControl的一个实例。
TargetInvocationException:由
调用的目标Exceptionhas被扔到
FileNotFoundException异常:无法加载文件或程序'CefSharp.Core,
系统找不到指定的文件。
版本= 45.0.0.0,文化=中性公钥= 40c4b6fc221f4138'或
它的一个依赖。后面
块引用>
代码
公共部分类CefSharpWebBrowserUserControl:用户控件
{
公共CefSharpWebBrowserUserControl()
{
的InitializeComponent();
VAR设置=新CefSettings();
settings.PackLoadingDisabled = TRUE;
=的WebBrowser新ChromiumWebBrowser();
WebBrowser.Address =www.google.com;
BrowserGrid.Children.Add(web浏览器);
}
公共ChromiumWebBrowser web浏览器{搞定;组; }
}
}
解决方案
的ClickOnce
默认情况下不包括unamanged
资源CefSharp
要求。有迹象表明,已经解决这个问题的许多问题。
下面是几个有用的。
搜索
GitHub上
项目始终是一个很好的资源。
https://github.com/cefsharp / CefSharp /搜索q =的ClickOnce和放大器;类型=问题和放大器; UTF8 =%E2%9C%93
您还需要确保
VC ++的Redist
安装在你的目标机器。请参见 https://github.com/cefsharp/CefSharp#version-branches 了解更多信息其中一个VC ++
的版本,你需要。
在一般情况下,请尝试搜索
GitHub上
/计算器
发布您的问题之前。I have a simple WPF application which works fine in debug but when i do a clickonce release its crashing when trying to load the CEFSharp web browser
I have a login page where the user then clicks open browser once clicked i get the following error
An unhandled exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
Additional information: The invocation of the constructor on type 'MyProject.Views.CefSharpWebBrowserUserControl' that matches the specified binding constraints threw an exception.
> <TabItem Header="Web Page" Name="CefWebPage"> > <Grid Background="#FFE5E5E5" Margin="0"> > <Grid.ColumnDefinitions> > <ColumnDefinition Width="871*"/> > </Grid.ColumnDefinitions> > <views:CefSharpWebBrowserUserControl x:Name="CefSharpWebBrowserUserControl"></views:CefSharpWebBrowserUserControl> > </Grid> > </TabItem>
Exception: Cannot create an instance of "CefSharpWebBrowserUserControl".
TargetInvocationException: Exceptionhas been thrown by the target of an invocation.
FileNotFoundException: Could not load file or assembly 'CefSharp.Core, Version=45.0.0.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138' or one of its dependencies. The system cannot find the file specified.
code behind
public partial class CefSharpWebBrowserUserControl : UserControl { public CefSharpWebBrowserUserControl() { InitializeComponent(); var settings = new CefSettings(); settings.PackLoadingDisabled = true; WebBrowser = new ChromiumWebBrowser(); WebBrowser.Address = "www.google.com"; BrowserGrid.Children.Add(WebBrowser); } public ChromiumWebBrowser WebBrowser { get; set; } } }
解决方案
ClickOnce
by default doesn't include theunamanged
resources thatCefSharp
requires. There are many issues that already address this topic.Here are a couple of useful ones
Searching the
GitHub
project is always an excellent resource. https://github.com/cefsharp/CefSharp/search?q=clickonce&type=Issues&utf8=%E2%9C%93You also need to make sure
VC++ Redist
is installed on your target machines. See https://github.com/cefsharp/CefSharp#version-branches for more info one whichVC++
version you require.In general, please try searching
GitHub
/StackOverflow
before posting your question.这篇关于使用CEFSharp Web浏览器中的ClickOnce发布崩溃WPF应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!