React-native-windows: run-windows broken after updating to Visual Studio 16.8

Created on 12 Nov 2020  路  18Comments  路  Source: microsoft/react-native-windows

Just following the official react-native-windows Getting Started guide and the example project won't build. I also followed all of the instructions for installing the dependencies found here: https://microsoft.github.io/react-native-windows/docs/rnw-dependencies

Environment

npx react-native --version
4.13.0

npx react-native info
info Fetching system and libraries information...
System:
OS: Windows 10 10.0.19041
CPU: (8) x64 Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
Memory: 9.26 GB / 15.95 GB
Binaries:
Node: 12.18.4 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.14.6 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK:
AllowAllTrustedApps: Disabled
AllowDevelopmentWithoutDevLicense: Enabled
Versions: 10.0.17763.0, 10.0.18362.0
IDEs:
Android Studio: Not Found
Visual Studio: 16.8.30709.132 (Visual Studio Community 2019)
Languages:
Java: Not Found
Python: 3.8.6
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.63.3 => 0.63.3
react-native-windows: ^0.63.0-0 => 0.63.8
npmGlobalPackages:
react-native: Not Found

Steps To Reproduce

  1. Follow steps at https://microsoft.github.io/react-native-windows/docs/getting-started up to running the npx react-native run-windows command.

Expected Results

The Getting Started example app to run on my desktop.

npx react-native run-windows --logging output (github won't let me post the entire output, but here is the error):

脳 Building Solution
脳 Build failed with message 11>C:\Program Files\dotnet\sdk\5.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(241,5): error NETSDK1005: Assets file 'c:\Users\david\Projects\testProj\node_modules\react-native-windows\Microsoft.ReactNative.Managed.CodeGen\obj\project.assets.json' doesn't have a target for 'netcoreapp3.1'. Ensure that restore has run and that you have included 'netcoreapp3.1' in the TargetFrameworks for your project. [c:\Users\david\Projects\testProj\node_modules\react-native-windows\Microsoft.ReactNative.Managed.CodeGen\Microsoft.ReactNative.Managed.CodeGen.csproj]. Check your build configuration.
See C:\Users\david\AppData\LocalTemp\msbuild_6944.err

bug must-have

Most helpful comment

Danny fixed it for the master branch (thanks Danny!) - requesting backport to 0.63

All 18 comments

Same problem

Looks like the Visual Studio 16.8 upgrade broke this. @dannyvv is taking a look

@dstampher I'm getting the same problem. As a temporary workaround, if you open the solution in the windows folder with Visual Studio and you deploy the application from there, you should be able to complete the build without errors.

Then you have to manually launch the package by running:

yarn start

from the project's folder. As last step, launch the application that has been deployed from the Start menu.

I am also running into this.

I saw somewhere that running Visual Studio for the first might help (it was true that I had installed it via Powershell and never actually opened it). Just starting Visual Studio wasn't enough but I specifically opened the solution for my new React Native Windows project and then when I ran npx react-native run-windows again it worked! But it only worked once, and no longer after that first time. Tried via command line, and via Visual Studio Code, and no luck.

Danny fixed it for the master branch (thanks Danny!) - requesting backport to 0.63

Should be fixed in 0.63 now too. Linking the VS ticket that tracks this (since it is not specific to React Native for Windows):
https://developercommunity.visualstudio.com/content/problem/1248649/error-netsdk1005-assets-file-projectassetsjson-doe.html

nuget
msbuild

Not fixed me. Am i doing something wrong?

the new version will be published on npm later today :)

(VS will always use the latest nuget (5.8.0 in the case of 16.8) but run-windows was stuck using 4.9.2 which got broken by VS 16.8)

the new version will be published on npm later today :)

(VS will always use the latest nuget (5.8.0 in the case of 16.8) but run-windows was stuck using 4.9.2 which got broken by VS 16.8)

But i couldn't run on visual studio either

@Frekansapp if you are building in VS, can you make sure you delete the nuget's folder and force a restore (I think Rebuild will do this)

vs
threw me 2927 errors :D

hata

Ekran Al谋nt谋s谋

Edit: Now i don't have a error but application not started

@Frekansapp this sounds like a separate issue, if you are still blocked could you please file a new bug? Thanks!

Ekran Al谋nt谋s谋

Edit: Now i don't have a error but application not started

I have the same in project from scratch (https://microsoft.github.io/react-native-windows/docs/getting-started) when build in console, see screenshot ManagedCodGen.jpg. When build via VisualStudio all ok, but when app starting I got crash, see screenshot crashWhenStarting.jpg.

VisualStudio version - 16.8.1
npm version - 6.14.8
node versio - v14.15.1
ManagedCodGen
crashWhenStarting

Dependecies:
"dependencies": {
"react": "16.13.1",
"react-native": "0.63.2",
"react-native-windows": "^0.63.0-0"
},
"devDependencies": {
"@babel/core": "^7.8.4",
"@babel/runtime": "^7.8.4",
"@react-native-community/eslint-config": "^1.1.0",
"babel-jest": "^25.1.0",
"eslint": "^6.5.1",
"jest": "^25.1.0",
"metro-react-native-babel-preset": "^0.59.0",
"react-test-renderer": "16.13.1"
},
crashWhenStarting
ManagedCodGen

@tarasvakulka please clean your node_modules and re-run yarn/clean build

@tarasvakulka please clean your node_modules and re-run yarn/clean build

I delete node_modules folder, run yarn cache clean, run yarn install, run npx react-native run-windows and still get error
image

Please try version 0.63.10 and if it does not work please file a new bug

Was this page helpful?
0 / 5 - 0 ratings