I have WPF .Net core 3.1 Desktop Application and trying to Add MicrosoftEdgeWebView2Runtime as prerequisite with Clickonce but I'm not able to find in prerequisite list.

Thanks in Advance. Ravi V.
Try to follow this guide.
I think that in your case you have download WebView2 installer and place it under, either Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages\, or <VS Install Dir>\MSBuild\Microsoft\VisualStudio\BootstrapperPackages\ together with product.xml file where you define how WebView2 should be installed.
Things seem to have moved on since this question was asked.
I've been digging into this and not found any definitive answers from Microsoft. However, today I noticed the following. I am publishing my .NET application using ClickOnce. I ticked '.NET Desktop Runtime 6' as a prerequisite in the dialog screenshotted in the question, which resulted in the following being added to my .pubxml file:
<BootstrapperPackage Include="Microsoft.NetCore.DesktopRuntime.6.0.x64">
<Install>true</Install>
<ProductName>.NET Desktop Runtime 6.0.26 (x64)</ProductName>
</BootstrapperPackage>
Then I ran the resulting setup.exe in a clean Windows 10 test environment which has Edge installed, but not any WebView runtime. At some point during installation of the .NET 6 runtime, "Microsoft Edge WebView 2 Runtime" also appeared in the Windows 'Apps & features' list!
So I conclude WebView2 is automatically included in newer versions of .NET Desktop Runtime.
Other sources suggest it is installed as a dependency of Office 365, and always present in Windows 11.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With