CefSharp is an easy way to embed a full-featured standards-compliant web browser into your C# and Autodesk Revit uses the CefSharp library internally for several features.
The only catch is Revit initializes CefSharp itself, which means if your Revit Addin uses CefSharp that could be some issue with the version of the package and your application is not gonna be able to initialize CefSharp.
If Revit already does the initialization of CefSharp and is deployed with the package, my Revit Addin does not need the CefSharp package itself, only the references gonna work if you use the same version that is shipped with Revit.
Each version of Revit has a specific version of the CefSharp:
- Revit 2024 – 105.3.390
- Revit 2023 – 92.0.260
- Revit 2022 – 65.0.1
- Revit 2021 – 65.0.1
- Revit 2020 – 65.0.1
- Revit 2019 – 57.0.0
Like this, I created a package to use for reference in my Revit Addin projects with CefSharp.
In an easy way just add the following reference in the csproj.
<PackageReference Include="ricaun.Revit.CefSharp" Version="$(RevitVersion).*" IncludeAssets="build; compile" PrivateAssets="All" />
This package adds the three CefSharp dll that exist in the specific version of Revit.
Using this configuration the Revit Addin project gonna have the reference of CefSharp and not gonna include the dlls because Revit already has the files.
I gonna create a project in the future using CefSharp, stay tuned on YouTube.