How do I include the Visual Studio C++ 2012/2013/2015 redistributables with my application?

CefSharp requires the Microsoft VC++ Runtime.

CefSharp Version VC++ Version .Net Version
65.0.0 and above 2015 4.5.2
51.0.0 to 63.0.0 2013 4.5.2
45.0.0 to 49.0.0 2013 4.0.0
43.0.0 and below 2012 4.0.0

For Microsoft's official guide see Redistributing Visual C++ Files on MSDN. To download visit Visual Studio C++ 2012/2013/2015 redistributables

A brief summary of your options for installing/including VC++ with your application are:

  • Install the Microsoft Visual C++ Redistributable Package on every machine on which you wish to run your CefSharp based application. Once installed updates can then be managed via Windows Update.
  • You can either set the Visual Studio C++ redistributables as pre-requisites of the installer (i.e. ClickOnce or WiX Toolset)
  • Copying over to your project the contents of this folder (Only present if you have the matching version of Visual Studio installed on your computer):
# For VC++ 2012 (x86)
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\redist\x86\Microsoft.VC110.CRT
# For VC++ 2012 (x64)
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\redist\x64\Microsoft.VC110.CRT

# For VC++ 2013 (x86)
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\x86\Microsoft.VC120.CRT
# For VC++ 2013 (x64)
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\x64\Microsoft.VC120.CRT

# For VC++ 2015 (x86)
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\x86\Microsoft.VC140.CRT
# For VC++ 2015 (x64)
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\x64\Microsoft.VC140.CRT

With the 3rd approach you won't need to install the prerequisite Visual C++ 2012/2013/2015 Runtime Files to your client. If you build your own from source what you deploy of course has to match your build environment. For the official Nuget releases see the Releases Branches table for details.

For VC++ 2013 JetBrains have a Microsoft.VC120.CRT.JetBrains package on Nuget.org, appears to include the relevant files, you would still need to hook up some sort of post build task to copy them to your bin folder.

For VC++ 2015 you may also need to package the Universal CRT, see the Distributing Software that uses the Universal CRT section of https://blogs.msdn.microsoft.com/vcblog/2015/03/03/introducing-the-universal-crt/ the last dot point titled App-local deployment of the Universal CRT is supported has details. Windows 10 includes the Universal CRT as an operating system component and there is no need to copy those files. UPDATE: See also https://docs.microsoft.com/en-us/cpp/windows/universal-crt-deployment?view=vs-2019

Note When building from source make sure you compile in Release mode when deploying to machines that don't have Visual Studio installed. Visual C++ uses a different set of run-time libraries for Debug and Release builds. The Debug run-time libraries are only installed with Visual Studio. If you use the official Nuget packages they're already built in Release mode and you can subsequently build your app in debug mode as only the Visual C++ projects need to be compiled in Release mode.

Guess you like

Origin www.cnblogs.com/yidanda888/p/11994370.html