Skip to content

Building WPF Locally

Ashish Kumar Singh edited this page Apr 13, 2022 · 1 revision

You can build wpf locally with build.cmd and provide the params like platform(x64/x86) and configuration(release/debug). For example, for x64 and release configuration:

./build.cmd -c release -plat x64

Now sometimes the local build fails with the following error, and this might happen frequently.

LINK(0,0): error C1047: (NETCORE_ENGINEERING_TELEMETRY=Build) The object or library file 'D:\a\_work\1\s\.packages\runtime.win-x64.microsoft.dotnet.wpf.dnceng\6.0.0-rtm.22161.2\runtimes\win-x64\native\bilinearspan.lib' was created by a different version of the compiler than other objects like 'D:\a\_work\1\s\artifacts\obj\wpfgfx\x64\Release\precomp.obj'; rebuild all objects and libraries with the same compiler

The cause for this error is that due to the LTCG and WholeProgramOptimization Flags, it is necessary to compile all the libs with the same compiler. In WPF case, some libs come from the internal repo i.e bilinearspan.lib in this case. So, if that repo were built on a different MSVC version than what you have on your build machine, The error would reproduce.

To avoid this:

  1. Make sure that the Visual Studio version you are using on your build machine matches with the Visual Studio version which is being used on the CI. To verify this, you can open the bilinearspan.lib in notepad and check for the MSVC version and in your binlog for the failed build check for the msvc version.
  2. If 1 holds true, you can request wpf team to trigger and flow the wpf-int built on latest version to the wpf repo. The usual process wpf team follows is to start a build for wpf-int and flow it to wpf repo which would result in a PR by bot which merges wpf-int's updated version to wpf repo.
Clone this wiki locally