静态链接的WebView2Loader产生无效的二进制文件

发布于 2025-01-31 17:01:00 字数 720 浏览 4 评论 0原文

我们正在尝试将WebView2集成到我们的Win32应用程序中,并且当它链接到WebView2loader.dll.lib到Load WebView2loader.dll时,它的工作正常。

我们遵循 msdn指令图书馆从静态上讲,到目前为止,这一直没有工作。在构建过程中,没有错误输出,即使在诊断设置的情况下,也看起来都很正确。 但是,生产的可执行文件没有有效的PE标头。

我们正在构建x86可执行文件,并且它正在与WebView2软件包的x86文件夹中的WebView2loaderstatic.lib链接,并通过Nuget下载。

使用的环境是:

Visual Studio 2017,所有更新,构建工具集141,Target Platform是Windows 10,Windows SDK版本为10.0.17763.0

更新1:我们已经发现,如果“生成调试信息,则“在链接器选项中,关闭了有效的二进制选项。但是,这对我们来说不是一个很好的解决方案,因此任何可能会有所帮助的想法都将不胜感激。我们的临时解决方案是编辑项目文件以有条件地设置静态链接标志,仅在执行释放构建时,并确保不包含调试信息。

We are trying to integrate WebView2 into our Win32 application, and it is working fine when it links to WebView2Loader.dll.lib to load WebView2Loader.dll.

We followed the MSDN instructions to link the library statically, and this has so far failed to work. There are no errors output during the build, and even with diagnostic setting all looks perfectly correct.
However, the executable produced does not have a valid PE header.

We are building an x86 executable, and it is linking with WebView2LoaderStatic.lib from the x86 folder of the WebView2 package, as downloaded with NuGet.

The used environment is:

Visual Studio 2017, with all updates installed, Build Toolset 141, Target Platform is Windows 10, Windows SDK Version is 10.0.17763.0

Update 1: We have discovered that if "Generate Debug Info" in Linker Options is turned off, a valid binary is generated. However, this is not a good solution for us in debug mode, so any ideas that might help would be deeply appreciated. Our temporary solution is to edit the project file to conditionally set the static linkage flag only when doing release builds, and ensure those doesn't contain debug info.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吻风 2025-02-07 17:01:00

WebView2LoaderStatic.lib is built using Visual Studio 2019 (v142) Platform Toolset.

See https://github.com/MicrosoftEdge/WebView2Feedback/issues/1404 and https://github.com/MicrosoftEdge/WebView2Feedback/issues/2462 for more information.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文