How to use previously Out-of-Browser-only features in LightSwitch for In-Browser Apps with VS 11 Beta
With LightSwitch for Visual Studio 11 Beta, the client is now built using Silverlight 5.Â One of the capabilities new to SL 5 is the ability to access certain classes and methods In-Browser that were previously only accessible Out-of-Browser.
Before proceeding, you should know that there are a few caveats.Â One is that you need to change some registry settings on each client machine to enable Elevated Trust applications to run In-Browser.Â Alternatively you can use Group Policy settings to accomplish this.Â Also, clients must use Internet Explorer.Â Finally, you must sign your XAP and be sure that the signing certificate is installed in the Trusted Root Certification Authorities store.Â You can find more information about these requirements here.
With vanilla Silverlight 5 applications, you can go to the application properties page and check “Require elevated trust when running in-browser”.
This setting, however, is not surfaced from the Visual Studio UI when working with a LightSwitch application.Â So for LightSwitch, you’ll need to edit the csproj file manually.Â Make sure your solution is closed in VS and find the csproj (or vbproj) file in the Client folder of your LS project.Â Find the <OutOfBrowserSettingsFile> line and add this line below it:
Save the file, then in the Properties folder, create this InBrowserSettings.xml file:
<InBrowserSettings> <InBrowserSettings.SecuritySettings> <SecuritySettings ElevatedPermissions="Required" /> </InBrowserSettings.SecuritySettings> </InBrowserSettings>
With that done, you should be able to make use In-Browser of the WebBrowser control, the Office Integration Pack, and many other controls previously restricted to Out-Of-Browser apps.