none
[UWP]I'm getting a "certificate could not be opened" error working on a UWP app. Not sure how to handle it. RRS feed

  • Question

  • I'm working on a UWP app for Windows 10. I work on it in two places: on my desktop and my laptop. I use Azure DevOps Services, both for storage as well as project management. I think I started this app on the desktop, then I cloned it to my laptop.

    My problem is I cannot build it on the laptop. I can't debug it, either. Looking online I see that the .pfx file is put into the .gitignore file, so what I have on my desktop isn't what I have on my laptop. Looking at my Azure DevOps repos, it definitelylooks like there's no .pfx file saved in the repo. At this point I'm just interested in editing and debugging the app on my laptop. I went to this page on SO, but it didn't seem to help. In particular in Jay Zuo's solution, in step 3, Configure Certificate list, I can't. It is disabled. Instead I see this:

    

    And if I try to build or debug it, I get an error that says:

    "Certificate could not be opened: Blank_TemporaryKey.pfx. Cannot find the requested object."

    So, how do I get around this problem?


    Rod


    Sunday, September 8, 2019 11:28 PM

All replies

  • Hi,

    There is no longer a Create test certificate button in the VS 2019. Now the certificate is automatically generated by the VS2019.

    There are two suggestions that might be able to help.

    First, please delete the bin and obj folder insider your package folder then try to clean and rebuild your solution. 

    Second, click the "Select a Certificate" button in the image you post, then just choose one test certificate from your laptop. 

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, September 9, 2019 2:13 AM
    Moderator
  • Hi Roy,

    I wish I'd seen this earlier this week. 

    I've deleted both the bin and obj folders from with folder directory for the UWP project. (I'm not sure what you mean by "package folder", so I deleted the bin and obj folders from the project's folder structure.)

    Then I did a Solution Clean, Solution Rebuild All. That failed, though, with the following error:

    Certificate could not be opened: Blank_TemporaryKey.pfx.
    Cannot find the requested object.

    As to your second suggestion, of clicking the "Select a Certificate" button in the Choose Certificate, then you suggested that I choose some certificate on my laptop. Uh, how do I do that? When I click on the "Select a Certificate" I'm presented with this dialog:

    No certificate available

    It looks to me as though there's no certificate on my laptop for me to choose.


    Rod

    Friday, September 13, 2019 11:00 PM
  • Hi,

    It seems that there is no other certificates in your laptop that you could use. Now the last way is to create a new one via powershell. You could refer this document: Create a certificate for package signing to create a new certificate and then you could use it in your app.

    A good news is that the VS team has noticed this issue that VS2019 could not create test certificate anymore. According to this thread:"Create Test Certificate" option missing from UWP SDK in VS2019, A fix for this issue has been internally implemented and is being prepared for release. It’s expected to roll out with 16.3 Preview 4

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, September 16, 2019 7:00 AM
    Moderator
  • I'm following the instructions whenever I can (limited opportunities to actually do so). According to the instructions on the link you gave, I'm go use whatever is in my .appxmanifest Publisher for the Subject of the certificate. I'm looking at the Publisher now for my app. It has:

    CN=daren

    Where in heck did that come from? And that's all that's there.


    Rod

    Wednesday, September 18, 2019 11:04 PM
  • Hi,

    According to the document:Identity (Windows 10), the publisher attribute represents the publisher information. If the app is not associated with the store, it will just show the name of the local account on which device that created the project. 

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, September 19, 2019 2:47 AM
    Moderator