microsoft / microsoft/react-native-windows

Build failed with message LINK : fatal error LNK1104: cannot open file 'msvcprtd.lib'

Open
#12,193 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area: Dependencies bug Workstream: ES Compliance SFI
Dominant language
C++
Stars
17.3k
Forks
1.2k
Avg merge
1d 13h
Merged PRs (30d)
33

Description

Problem Description

My problem seems to be the same from this bug report, which was closed due to inactivity.

I'm following the exact step-by-step guide from here, and installed all dependencies from here.

After trying to debug the app, I get the following error (some messages were in Portuguese, so I translated here):
2>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(1424,5): error MSB6006: "link.exe" exited with code 1104.
2>LINK : fatal error LNK1104: cannot open file 'msvcprtd.lib'
2>C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets(486,5): error MSB4181: The task "CompileXaml" returned false, but didn't registered any error.
2>Build project ready "RNWTest.vcxproj" -- FAILURE.
========== Build: 0 successful, 2 failed, 4 updated, 0 ignored ==========
========== Build started at 09:27 and took 26,598 seconds ==========
========== Deployment: 0 successful, 0 failed, 0 ignored ==========
========== Deploy started at 09:27 and took 26,598 seconds ==========

Steps To Reproduce
  1. Checking all dependencies: OK
    image
  2. Start a new react-native project by running npx react-native init RNWTest --version "latest"
  3. Enter project folder: cd RNWTest
  4. Install windows extension: npx react-native-windows-init --overwrite
  5. Open Visual Studio Community 2022 and running npx react-native autolink-windows at the root of the project. Result as follow:
    image
  6. Opened my solution file:
    image
  7. Set "Debug" and "x64":
    image
  8. Run yarn start at the project directory:
    image
  9. Run the project inside Visual Studio Community 2022. Get these errors:
2>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(1424,5): error MSB6006: "link.exe"
foi encerrado com o código 1104.
2>LINK : fatal error LNK1104: não é possível abrir o arquivo 'msvcprtd.lib'
2>C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets(486,5):
error MSB4181: A tarefa "CompileXaml" retornou false, mas não registrou um erro.
2>Projeto de compilação pronto "RNWTest.vcxproj" -- FALHA.
========== Compilação: 0 bem-sucedida, 2 com falha, 4 atualizada, 0 ignorada ==========
========== Compilação começou em 08:53 e levou 48,989 segundos ==========
========== Implantação: 0 bem sucedida, 0 com falha, 0 ignorada ==========
========== Implantar começou em 08:53 e levou 48,990 segundos ==========

Full debugging log is here: https://github.com/joaotextor/RNWTest/blob/master/debugging_log.txt

  1. When I go to http://localhost:8081/debugger-ui/, this screen is shown:
    image
  2. When trying to run npx react-native run-windows --logging, this is shown in red:
    LINK : fatal error LNK1104: não é possível abrir o arquivo 'msvcprtd.lib' [C:\Coding\RNWTest\node_modules\react-native-windows\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj] C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets(486,5): error MSB4181: A tarefa "CompileXaml" retornou false, mas não registrou um erro. [C:\Coding\RNWTest\node_modules\re act-native-windows\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj]

Full output for npx react-native run-windows --logging command is here: https://github.com/joaotextor/RNWTest/blob/master/error_log.txt

Expected Results

I should be able to see my new app, and Chrome should open as stated in the "Get Started with Windows" page:
image

CLI version

11.3.7

Environment
npx react-native infoinfo Fetching system and libraries information...
System:
  OS: Windows 10 10.0.22621
  CPU: "(16) x64 AMD Ryzen 7 5800H with Radeon Graphics         "
  Memory: 594.47 MB / 15.35 GB
Binaries:
  Node:
    version: 20.7.0
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 1.22.19
    path: ~\AppData\Roaming\npm\yarn.CMD
  npm:
    version: 10.1.0
    path: ~\AppData\Roaming\npm\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK:
    AllowDevelopmentWithoutDevLicense: Enabled
    Versions:
      - 10.0.19041.0
      - 10.0.22621.0
IDEs:
  Android Studio: Not Found
  Visual Studio:
    - 17.7.34031.279 (Visual Studio Community 2022)
Languages:
  Java:
    version: 11.0.18
    path: C:\Program Files\Amazon Corretto\jdk11.0.18_10\bin\javac.EXE
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.5
    wanted: 0.72.5
  react-native-windows:
    installed: 0.72.10
    wanted: 0.72.10
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found
Target Platform Version

10.0.19041

Target Device(s)

Desktop

Visual Studio Version

Visual Studio 2022

Build Configuration

Debug

Snack, code example, screenshot, or link to a repository

Public repository: https://github.com/joaotextor/RNWTest

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the RNWTest reproduction steps and run npx react-native run-windows --logging using the stated Windows, Visual Studio, SDK, and React Native versions. Read debugging_log.txt, error_log.txt, RNWTest.vcxproj, and Microsoft.ReactNative.vcxproj around the reported linker failure. Done means a newly created app builds, launches, and opens Chrome as shown in the expected results.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, react-native
Domain
build-system, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.