In continuation to my previous blog post on CefSharp / Chromium, we were trying to build and bundle the output of our CefSharp based WPF application for our client for their testing. However I noticed the CefSharp.BrowserSubprocess.exe
and related dlls / resources were being put in the main build output folder (not to a x86
/ x64
sub-folder inside build output folder) even when compiled for AnyCPU
.
Normally this won’t be a problem. Nobody has a x86 based Windows machine these days. Still for semantic reasons, and for separating core-Chromium resources from our own WPF build output, I wanted the build process to put Chromium resources in a x86
/ x64
sub-folder.
Normally I would have assumed an AnyCPU
build to handle this itself. But it wasn’t.
Googling turned up nothing useful. There were a ton of advices (including copying them manually or adding the resources to the C# project and setting the “Copy to Output Directory
” value on each such Chromium resource. I din’t find any such advice practical, for various reasons including the fact that I did not want to do this over and over again as we updated Chromium Nuget packages (as obviously output files from Chromium can change between multiple versions).
I did recall however that we have a previous CefSharp / Chromium project where the output was happening as desired by me. So the next thing I did was to open the new and older’s project .csproj
files side-by-side and compare them. What I figured was the presence of <Prefer32Bit>
tags in the older project under Debug|AnyCPU
and Release|AnyCPU
platform configurations (see screenshot below):

Voila! Adding those tags with the value set to false sent the chromium resources to x86 / x64 sub-directories of build output. Mission accomplished!!
Recent Comments