July 31, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

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


Tags: .NET



Page 4 of 5



Comment and Contribute

 


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

 

 


Sitemap | Contact Us

Rocket Fuel