Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update min required Visual C++ runtime from 2015 to 2019 #3636

Closed
4 tasks done
amaitland opened this issue Jun 23, 2021 · 5 comments
Closed
4 tasks done

Update min required Visual C++ runtime from 2015 to 2019 #3636

amaitland opened this issue Jun 23, 2021 · 5 comments
Assignees
Milestone

Comments

@amaitland
Copy link
Member

amaitland commented Jun 23, 2021

CEF is dropping support for compiling the C++ wrapper with Visual Studio 2015/2017 see https://groups.google.com/g/cef-announce/c/IMgnaeWipwc/m/so6nGWgWBgAJ for details.

As a flow on from we will be forced to migrate from Visual C++ 2015 as the minimum to Visual C++ 2019 runtime. A lot of users will already have the Visual C++ 2015-2019 runtime, so no action will be required.

I will provide further updates once M93 builds are available and I can confirm exactly what changes are required.

  • Update release notes
  • Update General Usage
  • Update FAQ
  • Update Readme.md

For those using the .Net Core 3.1/.Net 5.0 packages VC++ 2019 is already required.

@amaitland
Copy link
Member Author

amaitland commented Jul 30, 2021

Include include/base/cef_callback.h instead of include/base/cef_bind.h

As per https://groups.google.com/g/cef-announce/c/IMgnaeWipwc/m/so6nGWgWBgAJ we should use cef_callback.h instead. https://github.com/cefsharp/CefSharp/blob/master/CefSharp.Core.Runtime/RequestContext.cpp#L17

Note the following required changes to client code:

scoped_ptr → std::unique_ptr from . Related usage changes:

x.Pass() → std::move(x)
make_scoped_ptr → std::make_unique
scoped_ptr(x) → base::WrapUnique(x) from include/base/cef_ptr_util.h
OVERRIDE → override

arraysize → base::size from include/base/cef_cxx17_backports.h (or std::size with C++17)
NULL → nullptr (in most cases)
Include include/base/cef_callback.h instead of include/base/cef_bind.h (in most cases)
Implicit conversion of CefRefPtr or scoped_refptr to T* is gone; use x.get() instead

  • Replace OVERRIDE with override (b24cd8e)
  • Replace NULL with nullptr (a18637f)

Some of these changes will happen before upgrade to keep the changes in a single commit to a more reviewable size.

Branch https://github.com/cefsharp/CefSharp/tree/upgrade/93 has the work in process, it should compile, it won't run just yet. There is an incompatibility between our C++/CLI classes and the new IMPLEMENT_REFCOUNTING implementation. It looks like the use of atomic forces the class to be a native class instead of a mixed mode class.

  • Write a custom macro for ref counting (commit 911e856).

There are also a lot of other cleanup tasks

  • Remove the old compiler nuget packages
  • Update build scripts to remove old now unsupported versions of Visual Studio
  • Update ref counting macro to use CompareExchange

@amaitland
Copy link
Member Author

I will provide further updates once M93 builds are available and I can confirm exactly what changes are required.

Beta builds of version 93 are now available on https://cef-builds.spotifycdn.com/index.html

As expected attempting to build with VS2015/VS2019 failed.

As a result CefSharp will now require VS2019 to compile, Visual C++ 2019 will now be the new minimum (Visual Studio 2022 is in preview and I expect that Visual C++ 2020 will be backwards compatible).

@amaitland
Copy link
Member Author

amaitland commented Jul 30, 2021

For those that have the Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019 installed then no change will be required.

For those that have an older VC++ 2015/2017 installation there are a two options:

Local Deployment
As you should already have the Universal CRT installed as you previous had VC++ 2015/2017 installed (Universal CRT is also included as part of Windows 10 by default) you can bin deploy the VC++ 2019 dlls alongside your application.

The following should copy the VC++ runtime into the bin/publish folders when run under Visual Studio (won't work from the command line). NOTE: ClickOnce will need different targets to add the files.

For x86/x64:

  <Import Project="$(DevEnvDir)..\..\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.props"/>
  
  <Target Name="IncludeVisualCppInOutFolder" AfterTargets="ResolveReferences">
    <PropertyGroup>
      <_VCRedistLocation>$(DevEnvDir)..\..\VC\Redist\MSVC\$(VCToolsRedistVersion)\$(PlatformTarget)\Microsoft.VC142.CRT</_VCRedistLocation>
    </PropertyGroup>
    <Message Importance="high" Text="_VCRedistLocation = $(_VCRedistLocation)" />
    <ItemGroup>
      <ReferenceCopyLocalPaths Include="$(_VCRedistLocation)\**\*" />
    </ItemGroup>
  </Target>

For AnyCPU:

<Import Project="$(DevEnvDir)..\..\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.props"/>

<Target Name="IncludeVisualCppInOutFolder" AfterTargets="ResolveReferences">
    <PropertyGroup>
      <_VCRedistLocation32bit>$(DevEnvDir)..\..\VC\Redist\MSVC\$(VCToolsRedistVersion)\x86\Microsoft.VC142.CRT</_VCRedistLocation32bit>
      <_VCRedistLocation64bit>$(DevEnvDir)..\..\VC\Redist\MSVC\$(VCToolsRedistVersion)\x64\Microsoft.VC142.CRT</_VCRedistLocation64bit>
    </PropertyGroup>
    <Message Importance="high" Text="_VCRedistLocation32bit = $(_VCRedistLocation32bit)" />
    <Message Importance="high" Text="_VCRedistLocation64bit = $(_VCRedistLocation64bit)" />
    <ItemGroup>
      <_VCRedistFiles32bit Include="$(_VCRedistLocation32bit)\**\*"/>
      <_VCRedistFiles64bit Include="$(_VCRedistLocation64bit)\**\*"/>
      <ReferenceCopyLocalPaths Include="@(_VCRedistFiles32bit)" DestinationSubDirectory="x86\" />
      <ReferenceCopyLocalPaths Include="@(_VCRedistFiles64bit)" DestinationSubDirectory="x64\" />
    </ItemGroup>
</Target>

Visual C++ Runtime
Details on deploying/redistributing the Visual C++ 2019 runtime .

Universal CRT
For those looking for more detail on the Universal CRT

amaitland added a commit that referenced this issue Jul 31, 2021
OVERRIDE was a CEF macro which has been removed, use standard compliant override

Issue #3636
amaitland added a commit that referenced this issue Jul 31, 2021
@amaitland amaitland pinned this issue Aug 23, 2021
@amaitland amaitland added this to the 93.1.x milestone Aug 25, 2021
This was referenced Aug 29, 2021
amaitland added a commit that referenced this issue Sep 10, 2021
VS2019 is required to build now

Issue #3636
@jsoldi
Copy link

jsoldi commented Sep 18, 2021

Is this only for NET Core? According to

https://github.com/cefsharp/CefSharp/wiki/Output-files-description-table-(Redistribution)#Requirements

you only need the 2019 redistributables if you target NET Core, otherwise you can just use the 2015 redistributables.

@amaitland
Copy link
Member Author

As a flow on from we will be forced to migrate from Visual C++ 2015 as the minimum to Visual C++ 2019 runtime

VC++ 2019 is required for all packages now.

According to https://github.com/cefsharp/CefSharp/wiki/Output-files-description-table-(Redistribution)#Requirements

Wiki has been updated, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants