I’m trying to compile the React Native Windows application using the following configuration file:
version: 2.1
orbs:
win: circleci/windows@2.2.0
jobs:
build:
executor:
name: win/default
shell: cmd.exe
steps:
- checkout
- run:
name: "Install yarn"
command: yarn install --frozen-lockfile
- run:
name: "Build"
command: npx react-native run-windows --no-deploy --no-launch --no-packager --no-autolink --arch x64
But when restoring NuGet packages I receive the MSB4019 error complaining about missing projects and incorrect imports, like this one:
Error: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(2354,3): error MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\WindowsXaml\v16.0\Microsoft.Windows.UI.Xaml.Cpp.targets" was not found. Confirm that the expression in the Import declaration "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\WindowsXaml\v16.0\Microsoft.Windows.UI.Xaml.Cpp.targets" is correct, and that the file exists on disk.
I’ve tried two other servers with the following setups:
System:
OS: Windows 10 10.0.17763
CPU: (2) x64 Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz
Memory: 5.27 GB / 7.00 GB
Binaries:
Node: 12.18.4 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.5 - C:\npm\prefix\yarn.CMD
npm: 6.14.6 - C:\Program Files\nodejs\npm.CMD
Managers:
Cargo: 1.46.0 - C:\Rust\.cargo\bin\cargo.EXE
Composer: 1.10.13 - c:\tools\php\composer.BAT
Gradle: 6.6.1 - C:\ProgramData\Chocolatey\bin\gradle.EXE
Maven: 3.6.3 - C:\ProgramData\chocolatey\lib\maven\apache-maven-3.6.3\bin\mvn.CMD
pip3: 20.2.3 - C:\hostedtoolcache\windows\Python\3.7.9\x64\Scripts\pip3.EXE
RubyGems: 3.1.4 - C:\hostedtoolcache\windows\Ruby\2.5.8\x64\bin\gem.BAT
Utilities:
Bazel: 3.5.1 - /c/npm/prefix/bazel
CMake: 3.18.2 - /c/Program Files/CMake/bin/cmake
Git: 2.28.0. - /cmd/git
Virtualization:
Docker: 19.03.12 - C:\Program Files\Docker\docker.EXE
SDKs:
Android SDK:
Android NDK: 21.3.6528147
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
Versions: 10.0.14393.0, 10.0.16299.0, 10.0.17134.0, 10.0.17763.0, 10.0.18362.0, 10.0.19041.0
IDEs:
Visual Studio: 16.7.30503.244 (Visual Studio Enterprise 2019)
Languages:
Bash: 4.4.23 - C:\Program Files\Git\bin\bash.EXE
Go: 1.14.9 - C:\hostedtoolcache\windows\go\1.14.9\x64\bin\go.EXE
Java: 1.8.0_265 - /c/Program Files/Java/jdk8u265-b01/bin/javac
Perl: 5.32.0 - C:\Strawberry\perl\bin\perl.EXE
PHP: 7.4.9 - c:\tools\php\php.EXE
Python: 3.7.9 - /c/hostedtoolcache/windows/Python/3.7.9/x64/python
R: 4.0.2 - C:\Program Files\R\R-4.0.2\bin\x64\R.EXE
Ruby: 2.5.8 - C:\hostedtoolcache\windows\Ruby\2.5.8\x64\bin\ruby.EXE
Rust: 1.46.0 - /c/Rust/.cargo/bin/rustc
Databases:
MongoDB: 4.4.1 - C:\Program Files\MongoDB\Server\4.4\bin\mongo.EXE
MySQL: 5.7.21 - C:\mysql-5.7.21-winx64\bin\mysql.EXE
Browsers:
Internet Explorer: 11.0.17763.771
and:
System:
OS: Windows 10 10.0.18363
CPU: (8) x64 Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
Memory: 13.59 GB / 23.76 GB
Binaries:
Node: 12.9.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.10.2 - C:\Program Files\nodejs\npm.CMD
Utilities:
Git: 2.29.2.
SDKs:
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
AllowAllTrustedApps: Enabled
Versions: 10.0.18362.0
IDEs:
Visual Studio: 16.7.30621.155 (Visual Studio Community 2019)
Browsers:
Edge: Spartan (44.18362.449.0)
Internet Explorer: 11.0.18362.1
and build runs without any issues.
I’ve been searching for the solution and I’ve already tried to:
- install the BuildTools - but this is not the case, as BuildTools are already available on CircleCI setup
- set the correct paths manually - this didn’t solve the issue, as setting one variable leads to errors with another and it feels hacky and makes the config full of workarounds
- install buildtools using npm
and nothing worked, so I ran out of options.
Comparing each setup I can see that differences in Visual Studio should not be the case as the version’s difference is very minor in each of setups. Windows SDK also, but the only thing for React Native Windows is to have the SDK version 10.0.16299.0 or higher - this condition is met on each setup, including CircleCI.
Is there anything I’m missing in my config file or is there anything I can do on my side to get rid of this problem?
Let me know in case of more details are needed.