InPlaceHostingManager Constructors

Definition

Creates a new instance of InPlaceHostingManager to download and install the specified application.

Overloads

InPlaceHostingManager(Uri)

Creates a new instance of InPlaceHostingManager to download and install the specified browser-hosted application.

InPlaceHostingManager(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.

InPlaceHostingManager(Uri)

Creates a new instance of InPlaceHostingManager to download and install the specified browser-hosted application.

C#
public InPlaceHostingManager(Uri deploymentManifest);

Parameters

deploymentManifest
Uri

A Uniform Resource Identifier (Uri) to a ClickOnce application's deployment manifest.

Exceptions

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

Cannot pass null for the deploymentManifest argument.

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

Remarks

This constructor is used when you want to download a Windows Presentation Foundation-based application that is hosted in a Web browser. To download Windows Forms-based applications that are deployed using ClickOnce, use the InPlaceHostingManager constructor with the launchInHostProcess parameter set to false.

Applies to

.NET Framework 4.8.1 et autres versions
Produit Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

InPlaceHostingManager(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.

C#
public InPlaceHostingManager(Uri deploymentManifest, bool launchInHostProcess);

Parameters

deploymentManifest
Uri

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

launchInHostProcess
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.

Exceptions

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

Cannot pass null for the deploymentManifest argument.

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

Examples

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

C#
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();
}

Applies to

.NET Framework 4.8.1 et autres versions
Produit Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1