microsoft / microsoft/react-native-windows

codegen-windows does not generate .vcxproj, .vcxproj.filters, and stubs

Open
#14,822 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area: Native Modules Area: Turbo Modules bug Documentation
Dominant language
C++
Stars
17.3k
Forks
1.2k
Avg merge
1d 13h
Merged PRs (30d)
33

Description

Problem Description

Hello! 👋

I'm a beginner looking to get familiar with RNW, and I'm running into a strange issue. Whenever I run react-native codegen-windows in a test project, it only generates the <module-name>Spec.g.h file and a .clang-format file, but there are no C++ stubs and the .vcxproj and .vcxproj.filters are not created. Not sure if this is something I'm doing wrong, but I've tried it in a couple of projects and it doesn't appear to be working.

Steps To Reproduce
  1. Generate a new project with npx --yes @react-native-community/cli@latest init Test --version "0.79.0"
  2. cd into Test
  3. yarn add react-native-windows@^0.79.0
  4. yarn react-native init-windows --template cpp-app --overwrite
  5. Add NativeTestlib.ts into src
  6. Add the the below JSON to package.json
  7. Run react-native codegen-windows

JSON added to the package.json:

"codegenConfig": {
    "name": "RNTestlibSpec",
    "type": "modules",
    "jsSrcsDir": "src",
    "outputDir": {
      "ios": "ios/generated",
      "android": "android/generated"
    },
    "android": {
      "javaPackageName": "com.testlib"
    },
    "includesGeneratedCode": true,
    "windows": {
      "namespace": "testlibCodegen",
      "outputDirectory": "windows/testlib/codegen",
      "separateDataTypes": true
    }
  }
Expected Results

I expect that Codegen would produce the .vcxproj and other files mentioned previously.

CLI version

18.0.0

Environment
System:
  OS: Windows 11 10.0.26100
  CPU: (24) x64 12th Gen Intel(R) Core(TM) i9-12900KF
  Memory: 11.93 GB / 31.84 GB
Binaries:
  Node:
    version: 22.11.0
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 1.22.22
    path: C:\Program Files (x86)\Yarn\bin\yarn.CMD
  npm:
    version: 11.1.0
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK:
    AllowDevelopmentWithoutDevLicense: Enabled
    AllowAllTrustedApps: Enabled
    Versions:
      - 10.0.22621.0
      - 10.0.26100.0
IDEs:
  Android Studio: AI-232.10300.40.2321.11567975
  Visual Studio:
    - 17.12.35728.132 (Visual Studio Community 2022)
Languages:
  Java:
    version: 17.0.10
    path: C:\Program Files\Microsoft\jdk-17.0.10.7-hotspot\bin\javac.EXE
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli":
    installed: 18.0.0
    wanted: 18.0.0
  react:
    installed: 19.0.0
    wanted: 19.0.0
  react-native:
    installed: 0.79.1
    wanted: 0.79.1
  react-native-windows:
    installed: 0.79.0
    wanted: 0.79.0
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found
Community Modules

None

Target React Native Architecture

New Architecture (WinAppSDK) Only

Target Platform Version

None

Visual Studio Version

Visual Studio 2022

Build Configuration

Debug

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

No response

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

Reproduce the issue with the listed React Native Windows setup, the NativeTestlib.ts module, and the package.json codegenConfig, then run react-native codegen-windows. Compare the generated output with the expected .vcxproj, .vcxproj.filters, C++ stubs, .g.h file, and .clang-format file; the work is done when the missing Windows project and stub files are generated.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, react-native, typescript
Domain
build-system, cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.