tauri-apps / wry

Cross-platform WebView library in Rust for Tauri.
Apache License 2.0
3.72k stars 281 forks source link

Platform-specific note for Windows (Webview2 redistribution) #1268

Open fr-an-k opened 6 months ago

fr-an-k commented 6 months ago

With the x86_64-pc-windows-gnu target (cross-compilation) you automatically opt for the fixed version redistribution of Webview2. That's worthy of documentation.

The executable will give an error about WebView2Loader.dll because the wry documentation does not mention (yet) that you have to get the redistribution from here: https://developer.microsoft.com/en-us/microsoft-edge/webview2?form=MA13LH#download And choose a fixed version.

Details: https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution

fr-an-k commented 6 months ago

Actually it requires a code change, because you have to pass the distribution path to the CreateCoreWebView2EnvironmentWithOptions call; it doesn't work if you just place the files alongside the executable.

FabianLars commented 6 months ago

you automatically opt for the fixed version redistribution of Webview2

That's not true, what makes you think that? The need for the .dll is correct though, wry's docs are still from the time where we only supported the msvc toolchain.

fr-an-k commented 6 months ago

The error happens if you add wry on a x86_64-pc-windows-gnu target. The dynamic linkage seems to be a fallback for not finding the static webview2 Nuget library (in WSL Ubuntu in my case), which is probably an extra installation step outside of msvc, if possible at all.

FabianLars commented 6 months ago

Yes, the dll error/requirement is expected and really just how it works. What i mean is that this has no effect on whether you can use webview2 in evergreen mode or the fixed version and i'd like to know if we said something different somewhere (so we can update it).

fr-an-k commented 6 months ago

I just think this is important in the platform notes of the readme, or notes on cross-compilation.

I didn't see any installation steps in the readme (github homepage) and I'm not a Windows specific developer so I know nothing about nuget or msvc and my expectation is that I don't have to do further research to make it work and avoid errors.

A reference to the Microsoft docs would be helpful but it would be better if developers can just copy paste an install command to avoid many people wasting time on figuring out the same issue.

SkyLeite commented 5 months ago

Fwiw I reached this issue after running into the described error :)

bukowa commented 4 months ago

maybe related https://github.com/actions/runner-images/issues/9538