Export (0) Print
Expand All

InPlaceHostingManager Constructor (Uri, Boolean)

Creates a new instance of InPlaceHostingManager to download and install the specified application, which can be either a stand-alone Windows Forms-based application or an application hosted in a Web browser.

Namespace:  System.Deployment.Application
Assembly:  System.Deployment (in System.Deployment.dll)

public InPlaceHostingManager(
	Uri deploymentManifest,
	bool launchInHostProcess
)

Parameters

deploymentManifest
Type: System.Uri

The Uniform Resource Identifier (URI) to the deployment manifest of the application that will be installed.

launchInHostProcess
Type: System.Boolean

Whether this application will be run in a host, such as a Web browser. For a stand-alone application, set this value to false.

ExceptionCondition
PlatformNotSupportedException

InPlaceHostingManager can be used only in Windows XP or in later versions of the Windows operating system.

ArgumentNullException

Cannot pass null for the deploymentManifest argument.

ArgumentException

deploymentManifest uses a URI scheme that is not supported by ClickOnce.

The following code example demonstrates how to create an instance of InPlaceHostingManager that allows you to download Windows Forms-based applications deployed using ClickOnce.

InPlaceHostingManager iphm = null;

public void InstallApplication(string deployManifestUriStr)
{
    try
    {
        Uri deploymentUri = new Uri(deployManifestUriStr);
        iphm = new InPlaceHostingManager(deploymentUri, false);
    }
    catch (UriFormatException uriEx)
    {
        MessageBox.Show("Cannot install the application: " + 
            "The deployment manifest URL supplied is not a valid URL. " +
            "Error: " + uriEx.Message);
        return;
    }
    catch (PlatformNotSupportedException platformEx)
    {
        MessageBox.Show("Cannot install the application: " + 
            "This program requires Windows XP or higher. " +
            "Error: " + platformEx.Message);
        return;
    }
    catch (ArgumentException argumentEx)
    {
        MessageBox.Show("Cannot install the application: " + 
            "The deployment manifest URL supplied is not a valid URL. " +
            "Error: " + argumentEx.Message);
        return;
    }

    iphm.GetManifestCompleted += new EventHandler<GetManifestCompletedEventArgs>(iphm_GetManifestCompleted);
    iphm.GetManifestAsync();
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft