dcsimg
June 24, 2018
Hot Topics:

Deploying Separate User/Site Configurations with ClickOnce

  • February 25, 2009
  • By Matt Goebel and Rachel Baker
  • Send Email »
  • More Articles »

In addition to the using statements, add a reference to System.Web.

Figure 11: Adding the System.Web reference

Now, add the following code to the form's constructor. This code processes parameters from the URL used to deploy or launch the application. Once the parameters have been added to the dictionary collection, they can be used to change the text of the form.

public Form1()
{
   InitializeComponent();

   NameValueCollection nameValueTable = new NameValueCollection();

   if (ApplicationDeployment.IsNetworkDeployed)
   {
      if (ApplicationDeployment.CurrentDeployment.ActivationUri
         != null)
      {
         string queryString =
            ApplicationDeployment.CurrentDeployment.
               ActivationUri.Query;
         nameValueTable =
            HttpUtility.ParseQueryString(queryString);

         string[] values = new string[nameValueTable.Count];

         for (int i = 0; i < nameValueTable.Count; i++)
         {
            values[i] = nameValueTable[i];
         }
      }
   }

   if (nameValueTable.Count > 0)
   {
      if (nameValueTable.Keys[0].ToString().Equals("title"))
         this.Text = nameValueTable["title"].ToString();
   }
)

Next, right-click on the Project (*.csproj) and select Properties. Navigate to the 'Publish' tab. Enter the folder you created earlier, "C:\ClickOnceDeployment" Next, enter the IIS virtual directory created earlier as the Installation Folder URL. In this example, you are publishing to, installing from, and updating from the same location.



Click here for a larger image.

Figure 12: Configuring the ClickOnce deployment





Page 4 of 5



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

By submitting your information, you agree that developer.com may send you developer offers via email, phone and text message, as well as email offers about other products and services that developer believes may be of interest to you. developer will process your information in accordance with the Quinstreet Privacy Policy.

Sitemap

×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date