React-native-windows: Support for Visual Studio 2017

Created on 8 Feb 2017  路  7Comments  路  Source: microsoft/react-native-windows

Hey, is this going to support Visual Studio 2017 (RC). I tried it on a PC which has just VS 2017 UWP installed and it failed getting / restoring the NuGet Packages.

Most helpful comment

Further investigations reveals: bundled nuget.exe in react-native-windows is version 3.4.3. Version coming with VS2017RC is 3.5.0. Using the more recent version on the command line to restore the packages results in

Failed to load msbuild Toolset
  Could not load file or assembly 'Microsoft.Build, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

To get it working I opened up the sln file in VS2017, upgraded the C++ part (ChakraCore) to the latest toolset and make a rebuild of the solution. On the command line I started the React Native packager manually by entering
.\node_modules\react-native\packager\launchPackager.bat
After this background server started up successfully I was able to run the app from within VS2017RC...

All 7 comments

@appelgriebsch It should support VS 2017, and we'd love to have a contribution to get that working, if you have a fix.

@rozele it still says: Failed to restore Nuget packages... A Nuget restore is working fine. Opening up the solution file in VS2017RC and upgrading the Visual C++ toolset to 141 results in a successful compile of it... still not able to start the app due to missing background JavaScript bundle...

Executing the command from the internal Nuget restore that is triggered when using run-windows will give the following error:

MSBuild auto-detection: using msbuild version '4.0' from 'C:\Windows\Microsoft.NET\Framework\v4.0.30319'.
C:\Users\appel\GitHub\sampleUWP\windows\sampleUWP\sampleUWP.csproj(218,3): error MSB4019: The imported project "C:\Prog
ram Files (x86)\MSBuild\Microsoft\WindowsXaml\v15.0\Microsoft.Windows.UI.Xaml.CSharp.targets" was not found. Confirm th
at the path in the <Import> declaration is correct, and that the file exists on disk.
C:\Users\appel\GitHub\sampleUWP\node_modules\react-native-windows\ReactWindows\ReactNative\ReactNative.csproj(210,3): e
rror MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v15.0\Microsoft.Windows.UI.Xam
l.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists
 on disk.

Further investigations reveals: bundled nuget.exe in react-native-windows is version 3.4.3. Version coming with VS2017RC is 3.5.0. Using the more recent version on the command line to restore the packages results in

Failed to load msbuild Toolset
  Could not load file or assembly 'Microsoft.Build, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

To get it working I opened up the sln file in VS2017, upgraded the C++ part (ChakraCore) to the latest toolset and make a rebuild of the solution. On the command line I started the React Native packager manually by entering
.\node_modules\react-native\packager\launchPackager.bat
After this background server started up successfully I was able to run the app from within VS2017RC...

OH I didn't realize that I had to use the old version of Visual Studio (2015). Is that still correct? I'm trying to run my app with Visual Studio Community 2017, but there seems to be tons of issues and nothing is working. I'll try to downgrade to 2015 and see if that helps.

EDIT: I see no way to downgrade to 2015. The only available version is 2017, so I really have no idea what to do.

Hi @appelgriebsch, would you mind explaining how to do this?

I attempted to use "Retarget Projects", and I chose the newer versions, but now I get 140 build errors saying:

Severity    Code    Description Project File    Line    Suppression State
Error   CS0012  The type 'IAsyncAction' is defined in an assembly that is not referenced. 
You must add a reference to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.  
ReactNative 
C:\code\myapp\node_modules\react-native-windows\ReactWindows\ReactNative.Shared\Bridge\JavaScriptBundleLoader.cs    
94  Active

Did you find solution for this problem..
I am also using visual studio community edition 2017.. everything seems broken.. when i change chakraBridge to old SDK 10.0.393.. it auto matically points it back to 16.X.X .. I am following this guide
https://github.com/Microsoft/react-native-windows/blob/master/docs/GettingStarted.md
its been a day.. i am able to run my react native on android and ios..
even react-native run-windows
gives heaps of errors..
Do i need to downgrade my visual studio?

Was this page helpful?
0 / 5 - 0 ratings