Create a exe file for installing a p7b file into related store in Windows
<p>I want create a exe file (windows) in C# for installing a p7b file that contains 5 certificates but I want load a p7b file and then read it and install root cer into root store and install intermediate cer into intermediate store and subcer to intermediate store too,the sample code is here but there is a error that I don't know what I must do ?please help me.</p>

<pre><code>namespace certificate
{
    static class Program
    {
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            String content = Encoding.UTF8.GetString(certContent); 
            String base64Content = content.Replace("-----BEGIN CERTIFICATE-----", "").Replace("-----            END CERTIFICATE-----", "").Replace("\r", "").Replace("\n", ""); 
            byte[] decodedContent = Convert.FromBase64String(base64Content); 
            SignedCms certContainer = new SignedCms(); 
            certContainer.Decode(decodedContent); 

            string[]  filePaths = Directory.GetFiles(@"d:\", "*.p7b");
            SignedCms certContainer = new SignedCms(); 
            certContainer.Decode(certContent); 
            foreach(X509Certificate2 cert in certContainer.Certificates) 
            { 
              ... 
            } 

            try
            {
                new WebClient().DownloadFile("http://mocca.ir/MFPortal/APP_Client/UserFiles/File/IRI%20ROOT%20CA.crt", Application.StartupPath + @"\certnew.cer");
                string fileName = Application.StartupPath + @"\certnew.cer";
                X509Certificate2 certificate = new X509Certificate2(fileName);
                X509Store store = new X509Store(StoreName.Root, StoreLocation.LocalMachine);
                store.Open(OpenFlags.ReadWrite);
                store.Add(certificate);
                store.Close();
                File.Delete(fileName);
                MessageBox.Show("گواهينامه بروي رايانه شما نصب گرديد");
            }
            catch (Exception)
            {
                MessageBox.Show("عمليات با خطا مواجه شده. لطفا مجددا تلاش کنيد.\n توجه داشته باشيد براي عملکرد صحيح بايد با دسترسي مدير سيستم(Administrator) برنامه را اجرا نماييد", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
            }
            Application.Exit();
        }
    }
}
</code></pre>
