Search code examples
visual-studioreact-nativevisual-studio-2019react-native-windows

react-native run-windows gives error : Certificate could not be opened: TemporaryKey.pfx error


I am working on the react-native-windows project. I followed the instructions given here https://microsoft.github.io/react-native-windows/docs/getting-started. In the run command, react-native run-windows, I get an error error : Certificate could not be opened: TemporaryKey.pfx

I am running Microsoft Visual Studio Community 2019 Version 16.7.2 on Windows 10 version 2004 build 19041.450


Solution

  • Try opening the YourApp.sln file in the Solution Explorer in Visual Studio (there is a little dropdown to switch views in the solution explorer at the top). Then open Package.appxmanifest and go to the "Packaging" tab. There should be something that says "Publisher" about halfway down with a button that says "Choose Certificate". Click that. There are three buttons below that say Select from store, Select from file, and Create. Click create. Enter the info and okay, then build again with npx react-native run-windows in the terminal. It should clear that error about the Certificate. I found that I also have to do yarn install first. Hope that helps. I'm just learning myself so I may not be right.