MAUI how to load pfx embedded

Dario Galvani 1 Reputation point
2022-11-05T10:00:45.527+00:00

Hi all,
I'm really neewbie in MAUI and I'm doing some exercises to undestand how it works.
Now, I'm going mad about this issue.

I have a file myCert.pfx (compiling action as embedded resource). I'd like manage it.

	var certificate = new X509Certificate2("myCert.pfx", "", X509KeyStorageFlags.Exportable);  

Everything I do I get "fileNotFound Exception" ...

Which is the right way to write the istruction? or What I've got to do to make it works?

TIA
Dario

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,072 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 37,826 Reputation points Microsoft Vendor
    2022-11-07T02:26:49.217+00:00

    Hello,

    On MAUI, you need to use Assembly to open the embedded resource file.

    Please refer to the following documentation and sample to get more details about it.

    Despite this Xamarin's documentation, after my testing, it still works fine on maui.

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments