IntroductionIn order to run your Full Trust enabled WPF XBAP application, you have to use “Self signed certificate authority file” for running and deploying XBAP application. The certificate should pushed it into “Trusted Publisher” and “Authority Root” certificate storages. You can use X509Certificate2 and X509Store classes in your installer assembly for pushing the certificate to certificate storage. Please use the following code snippet. string certPath = string.Format(@"{0}\Aaa.cer", Environment.GetFolderPath(Environment.SpecialFolder.System));
X509Certificate2 certificate = new X509Certificate2(certPath);
X509Store trustedPublisherStore = new X509Store(StoreName.TrustedPublisher, StoreLocation.LocalMachine);
X509Store trustedAuthorityRootStore = new X509Store(StoreName.AuthRoot, StoreLocation.LocalMachine);
try{
trustedPublisherStore.Open(OpenFlags.ReadWrite);
trustedPublisherStore.Add(certificate);
trustedAuthorityRootStore.Open(OpenFlags.ReadWrite);
trustedAuthorityRootStore.Add(certificate);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + "\n\n" + ex.StackTrace);
}
finally{
trustedPublisherStore.Close();
trustedAuthorityRootStore.Close();
}For more information about Signing & Deploying CAB Based ClickOnce Code.Please refer the following link to know more about “WPF - XBAP as Full Trust Application”
http://blogs.microsoft.co.il/blogs/maxim/archive/2008/03/05/wpf-xbap-as-full-trust-application.asp. i hope this is help to you and thank you for reading. |