React-native-windows: Building CLI app with Visual Studio 2019 hits certificate build error

Created on 23 Aug 2019  路  3Comments  路  Source: microsoft/react-native-windows

On a fresh machine with only Visual Studio 2019 installed, I cannot successfully build a CLI app in VS 2019. I hit a certificate related build error.

Repro Steps:
react-native init helloworld --version 0.59.10
cd helloworld
yarn add rnpm-plugin-windows
react-native windows --template vnext
Open VS solution and build

RESULT
Build Error:
Certificate could not be opened: helloworld_TemporaryKey.pfx.The specified network password is not correct.

I'm pretty sure this is specific to VS 2019. I've not repro'ing this on my other machine which has VS 2017.

CLI bug must-have

Most helpful comment

I had the same issue. Here is my temporary workaround:

  1. Generate a new PFX file using MMC.

  2. In windows/<ProjectName>, replace <ProjectName>_TemporaryKey.pfx by the new one.

  3. Update <ProjectName>.csproj as follows:

<PackageCertificateKeyFile>(((ProjectName)))_TemporaryKey.pfx</PackageCertificateKeyFile>
<PackageCertificateThumbprint>(((ThumbprintOfTheCertificate)))</PackageCertificateThumbprint>
<PackageCertificatePassword>(((PasswordOfThePFXFile)))</PackageCertificatePassword>

To get (((ThumbprintOfTheCertificate))), go to MMC, navigate to the certificate, and right-click, choose Properties.

  1. Build the project using Visual Studio 2019.

Note that the command react-native run-windows does not work yet, because it does not use the .csproj file and does not know (((PasswordOfThePFXFile))).

All 3 comments

I'm pretty sure this is specific to VS 2019. I've not repro'ing this on my other machine which has VS 2017.

I had the same issue and VS 2017 works fine for me too.

I had the same issue. Here is my temporary workaround:

  1. Generate a new PFX file using MMC.

  2. In windows/<ProjectName>, replace <ProjectName>_TemporaryKey.pfx by the new one.

  3. Update <ProjectName>.csproj as follows:

<PackageCertificateKeyFile>(((ProjectName)))_TemporaryKey.pfx</PackageCertificateKeyFile>
<PackageCertificateThumbprint>(((ThumbprintOfTheCertificate)))</PackageCertificateThumbprint>
<PackageCertificatePassword>(((PasswordOfThePFXFile)))</PackageCertificatePassword>

To get (((ThumbprintOfTheCertificate))), go to MMC, navigate to the certificate, and right-click, choose Properties.

  1. Build the project using Visual Studio 2019.

Note that the command react-native run-windows does not work yet, because it does not use the .csproj file and does not know (((PasswordOfThePFXFile))).

Fix merged.

Was this page helpful?
0 / 5 - 0 ratings