Repository navigation
Feature Request - Side by side installation #3161
Description
Activity
However, it is currently impossible to deploy the CefSharp libraries side by side (i.e. in the same directory) as the x86 and x64 versions of the libraries have the same name
This should be possible with the current packages, set CefSharpTargetDir to PlatformTarget in your project file to copy the files into a sub directory.
https://github.com/cefsharp/CefSharp/blob/cefsharp/81/NuGet/CefSharp.Common.targets#L12
You can then try your proposed app.config solution.
Suggestion sounds interesting, you are welcome to submit a PR.
Now that #3319 is complete the
CefSharp.dll/CefSharp.Core.dll/CefSharp.Wpf.dll/CefSharp.WinForms.dll/CefSharp.OffScreen.dllfiles are nowAnyCPU.You can
<CefSharpTargetDir>$(PlatformTarget)</CefSharpTargetDir>to your project file, for the olderNon SDK Stylethis would look like the following.<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> <DebugSymbols>true</DebugSymbols> <OutputPath>bin\x64\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <DebugType>full</DebugType> <PlatformTarget>x64</PlatformTarget> <ErrorReport>prompt</ErrorReport> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <Prefer32Bit>false</Prefer32Bit> <CefSharpTargetDir>x64</CefSharpTargetDir> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> <DebugSymbols>true</DebugSymbols> <OutputPath>bin\x86\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <DebugType>full</DebugType> <PlatformTarget>x86</PlatformTarget> <ErrorReport>prompt</ErrorReport> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <Prefer32Bit>false</Prefer32Bit> <CefSharpTargetDir>x86</CefSharpTargetDir> </PropertyGroup>Then to load the arch specific files at compile time you can use something like the following in your proj file (written in notepad so might need some tweaks, based off https://github.com/cefsharp/CefSharp/blob/cefsharp/87/NuGet/CefSharp.Common.targets#L301)
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" /> <Target Name="CefSharpAppConfigTransform" AfterTargets="_CopyAppConfigFile"> <TransformXml Source="@(AppConfigWithTargetPath->'$(OutDir)%(TargetPath)')" Transform="$(CefSharpCommonTransform32)" Destination="@(AppConfigWithTargetPath->'$(OutDir)%(TargetPath)')"/> <TransformXml Source="@(AppConfigWithTargetPath->'$(OutDir)%(TargetPath)')" Transform="$(CefSharpCommonTransform64)" Destination="@(AppConfigWithTargetPath->'$(OutDir)%(TargetPath)')"/> </Target>To load the arch specific files are runtime you can use
Option 2from #1714 to detect and load the dll at runtime. There are a few other options for this you could also use.
#1714 includes instructions for using CefSharp with an AnyCPU application. However, it is currently impossible to deploy the CefSharp libraries side by side (i.e. in the same directory) as the x86 and x64 versions of the libraries have the same name. Building on the instructions given in #1714 I suggest this project do the following:
a.
<dependentAssembly>section for each CefSharp library containing:<assemblyIdentity>withnameandprocessorArchitectureattributes specified.<codeBase>relative path to the library in x86/x64 folders respectively.This allows developers using this library to generate platform specific executables such as app.x86.exe and app.x64.exe and deploy them in the same directory. It also eliminates having to do anything special for AnyCPU based applications as it provides all the information needed to locate the appropriate platform specific library.