Salakhetdinov Shamil
mcp2004 at mail.ru
Fri Apr 3 08:21:58 CDT 2009
Hi Gustav, I think this is how I did get certifciate: 1. VS Project Entry -> Right-Click -> Signing -> Create Test Certificate... 2. VS shows "Create Test Certificate" dialog 3. Enter and confirm password -> Click OK 4. Click [More Details] -> and see "This CA Root certificate is not trusted... blah,blah, blah... 5. Click [Install Certificate...] 6. VS shows "Welcome to the Certificate Import Wizard" dialog 7. [Next] 8. Select "Place all certificates in the following store" 9. [Browse...] 10. Select "Trusted Root Certification Authorities" 11. [Next] 12. [Finish] 13. [Security Warning] dialog - blah,blah,blah -> click [Yes] 14. The import was successfull message -> [OK] 15. [OK] 16. Click [More Details] -> and see "This certificate is intended for the following purposes..." ----- To accept click-once URL parameters you have to use Project Properties->Publish->Options... -> Allow URL Parameters to be passed to Application Below is code behind for WPF form. Note the following references has to be added manually: - System.Windows.Forms (not needed if WPF MessageBox is used) - System.Web - System.Deployment ---------- code ----------- using System.Windows; using System.Collections.Specialized; using System.Windows.Forms; using System.Web; using System.Deployment.Application; namespace MySampleWpfApplication1 { /// <summary> /// Interaction logic for Window1.xaml /// </summary> public partial class Window1 : Window { public Window1() { InitializeComponent(); } private void button1_Click(object sender, RoutedEventArgs e) { System.Windows.Forms.MessageBox.Show("Test Message", "Test", MessageBoxButtons.OK); } private void button2_Click(object sender, RoutedEventArgs e) { System.Environment.Exit(0); } private NameValueCollection GetQueryStringParameters() { NameValueCollection nameValueTable = new NameValueCollection(); if (ApplicationDeployment.IsNetworkDeployed) { string queryString = ApplicationDeployment.CurrentDeployment.ActivationUri.Query; nameValueTable = HttpUtility.ParseQueryString(queryString); } return (nameValueTable); } private void Window_Loaded(object sender, RoutedEventArgs e) { NameValueCollection args = GetQueryStringParameters(); if (args == null) return; if (args.Count <= 0) return; string company = args["Company"]; string userId = args["UserId"]; companyTextBox.Text = company; userTextBox.Text = userId; } } } Test: http://shamils-4.hosting.parking.ru/click-once/MySampleWpfApplication.application?Company=Test&UserId=Guest Thank you. -- Shamil -----Original Message----- From: "Gustav Brock" <Gustav at cactus.dk> To: <dba-vb at databaseadvisors.com> Date: Fri, 03 Apr 2009 11:28:09 +0200 Subject: Re: [dba-VB] Click-Once setup... > Hi Shamil > > How/where did you obtain a code signing certificate? > > Nice tip about the URL parameters, didn't know about that option. > > External tools to VS may only be needed - as I mentioned - if you wish to include additional components to install with your ClickOnce setup - like a special font as in my case. > > /gustav <snip>