locked
[UWP]Not able to submit to store with 'WindowsRuntimeAccess="all"' set as a 'uap:Rule' in one of 'uap:ApplicationContentRules' in Package.appxmanifest of a UWP C# Application. RRS feed

  • Question

  • I am developing a UWP C# application for windows 10 and I came across a scenario where I need to invoke UWP WinRT APIs from WebView using JavaScript. I know it is possible with WinJS project but I need to do it in C# UWP Application.

    After doing some research I came to know about a workaround for doing the same. By adding the below snippet to my Applicaiton's Package.appxmanifest file I am able to use UWP APIs inside JavaScript.

    <uap:ApplicationContentUriRules>
          <uap:Rule Match="ms-appx-web:///" Type="include" WindowsRuntimeAccess="all" />
    </uap:ApplicationContentUriRules>

    But the problem now is, when ever I submit the Applicaiton with above mentioned change to store, certification process is failing with below mentioned error.

    The Application cannot include an ApplicationContentUriRule with 'all' or 'allowForWebOnly' WindowsRuntimeAccess while any of the following capabilities are enabled: enterpriseAuthentication, sharedUserCertificates, musicLibrary, picturesLibrary, videosLibrary, removableStorage, documentLibrary, internetClientServer, privateNetworkClientServer.

    I need the above mentioned capabilities along with the WinJS functionality.

    Is this even possible? If yes, Can anyone please help me resolve this issue with some useful work around?


    Friday, May 25, 2018 7:30 AM

All replies

  • Hi Nanda Velugoti,

    No, as it is mentioned clearly in the error message, you could not do that.

    If you need to call uwp APIs in a HTML page, a comman workaround is that using WebView.ScriptNotify Event. This could be used to interacting with code behind. You could also use use the InvokeScriptAsync method to interacting with webview content in the code behind.

    You could get more information from the link here: https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.webview#remarks

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, May 28, 2018 2:41 AM