Creating A Full Trust Avalon Web Browser (.xbap) Application
I recently needed to create a full trust .xbap application on the November CTP. As you may know, Avalon Web Browser applications run in a sandbox, which allows them to be installed without any security prompts. However, there are cases, such as intranet applications, where allows an in-browser application to do more makes sense. It took some help from the Avalon team to know how to make this work, which I thought I'd share to the world. For some more links on this, see:
Here are the steps:
1. Change the TargetZone of the appliction to custom. This can be done manually by hacking the .proj file or can be done in Visual Studio by going to Project Properties, going to the Security tab, and changing the dropdown to (custom).
2. Add the Unrestricted="true" attribute to the manifest of the appliction, which is located in the Properties folder. The manifest should look something like this:
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<defaultAssemblyRequest permissionSetReference="Custom" />
3. Deploy the application using the Visual Studio Publish Wizard.
4. If you launch the application from the file system aka local zone, all will be hunky dory. However, if you want to deploy this from the web, the certificate used to sign the manifest will have to be added to the Trusted Publishers store within Internet Explorer. By default, VS generates a .pfx key when you create a Web Browser application. Of course, real deployments, a company issued certificate would be more appropriate to use. Getting a cert into the store can be done by double clicking the cert or by using the certmgr tool with the appropriate commandline switches.