Unity.IL2CPP.Building.BuilderFailedException (baselib.dll does not exist)

When I try to build my Unity project via script, the build process cannot find the file baselib.dll. I have the feeling that the path was set incorrectly in a build tool.

Path where the baselib.dll cannot be found (during the build process):
E:\UnityEditors\2021.1.24f1\Editor\Data\PlaybackEngines\MetroSupport\Players\UAP\il2cpp\Release\baselib.dll

Path where the baselib.dll currently exists:
E:\UnityEditors\2021.1.24f1\Editor\Data\PlaybackEngines\MetroSupport\Players\UAP\il2cpp*XXX*\release\baselib.dll

*XXX = ARM, ARM64, x64, x86

      Time Compile: 26455 milliseconds Unity.TextMeshPro4.cpp
      Time Compile: 25070 milliseconds System2.cpp
      Time Compile: 24638 milliseconds Lump_libil2cpp_os.cpp
      Time Compile: 22077 milliseconds Unity.TextMeshPro2.cpp
  Total compilation time: 338707 milliseconds.
EXEC : error : Unity.IL2CPP.Building.BuilderFailedException: The Baselib library 'E:\UnityEditors\2021.1.24f1\Editor\Data\PlaybackEngines\MetroSupport\Players\UAP\il2cpp\Release\baselib.dll' does not exist and is required for this build. [C:\Gitlab-Runner\builds\APdqwQiz\0\robotik\mixed-reality\demo-suitcase-b4kmu\Demo-Suitcase-B4KMU\Releases\UWP\Il2CppOutputProject\Il2CppOutputProject.vcxproj]
     at Unity.IL2CPP.Building.BuildDescriptions.IL2CPPOutputBuildDescription.BaselibLibrary(String baselibLibraryName, BuildConfiguration configuration)
     at Unity.IL2CPP.Building.BuildDescriptions.IL2CPPOutputBuildDescription.GetDynamicLibraries(BuildConfiguration configuration)+MoveNext()

build parameters:

$MSBUILD_EXE" "$PROJECT_SLN" /p:Configuration=Release /p:Platform="x86" /p:AppxBundle=Always /p:AppxBundlePlatforms="x86|ARM64" /p:UseSubFolderForOutputDirDuringMultiPlatformBuild=false

From “Unity Data.vcxproj” file:

<None Include="$(UnityWSAPlayerDir)Players\UAP\il2cpp\$(PlatformTarget)\$(UnityPlayerConfiguration)\baselib.dll">

Try also specifying “PlatformTarget” variable on the command line:

/p:PlatformTarget:x86

I was having the same issue. I manually copied the master folder one level up in the directory structure so that the tool would find it.
There’s a command in the MRTK build window that has a wrong argument and don’t know where that is coming from. Probably a bug in their code.
Unfortunately I just start this project which is a handover from another vendor and updating Unity and MRTK versions is not a good idea right now…