UpdateManifestForBrowserApplication Task

 

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

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.

ParameterDescription
ApplicationManifestRequired ITaskItem[] parameter.

Specifies the path and name of the application manifest file that you want to add the <hostInBrowser /> element to.
HostInBrowserRequired 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.

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.

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

<Project xmlns="http://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>  

WPF MSBuild Reference
Task Reference
MSBuild Reference
Task Reference
Building a WPF Application (WPF)
WPF XAML Browser Applications Overview

Show: