Share via


UpdateManifestForBrowserApplication Task

The UpdateManifestForBrowserApplication task is run to add the <hostInBrowser /> element to the application manifest (projectname.exe.manifest) when a XAML browser application (XBAP) project is built.

Task Parameters

Parameter

Description

ApplicationManifest

Required ITaskItem[] parameter.

Specifies the path and name of the application manifest file that you want to add the <hostInBrowser /> element to.

HostInBrowser

Required Boolean parameter.

Specifies whether to modify the application manifest to include the <hostInBrowser /> element. If true, a new <hostInBrowser /> element is included in the <entryPoint /> element. Note that element inclusion is cumulative: if a <hostInBrowser /> element already exists, it is not removed or overwritten. Instead, an additional <hostInBrowser /> element is created. If false, the application manifest is not modified.

Remarks

XBAPs are run by using ClickOnce deployment and, therefore, must by published with supporting deployment and application manifests. Microsoft build engine (MSBuild) uses the GenerateApplicationManifest task to generate an application manifest.

Then, to configure an application to be hosted from a browser, an additional element, <hostInBrowser /> must be added to the application manifest, as show in the following example:

<!--MyXBAPApplication.exe.manifest-->
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly ... >
    <asmv1:assemblyIdentity ... />
    <application />
    <entryPoint>
      ...
      <hostInBrowser xmlns="urn:schemas-microsoft-com:asm.v3" />
    </entryPoint>
  ...
/>

The UpdateManifestForBrowserApplication task is run when an XBAP project is built in order to add the <hostInBrowser /> element.

Example

The following example shows how to ensure that the <hostInBrowser /> element is included in an application manifest file.

<Project xmlns="https://schemas.microsoft.com/developer/msbuild/2003">
  <UsingTask 
    TaskName="Microsoft.Build.Tasks.Windows.UpdateManifestForBrowserApplication"
    AssemblyFile="C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\PresentationBuildTasks.dll" />
  <Target Name="UpdateManifestForBrowserApplicationTask">
    <UpdateManifestForBrowserApplication
      ApplicationManifest="MyXBAPApplication.exe.manifest"
      HostInBrowser="true" />
  </Target>
</Project>

See Also

Concepts

Building a WPF Application (WPF)

WPF XAML Browser Applications Overview

Other Resources

WPF MSBuild Reference

WPF MSBuild Task Reference

MSBuild Reference

MSBuild Task Reference