2

It's the first time I make a Windows Universal application and I was not able to make everything in my UWP app (for example it's impossible to start a command line Process). Since this is a personal app (I don't want to put it on the store) I used windows.fullTrustProcess to start a WPF win32 application to make what I was not able to do in my main application. I was also forced use UWP because I need a WebView able to play fullscreen html5 videos.

When I try to use my application inside Visual Studio 2017 everything work, but when I try to make a package I get this error:

"Manifest validation error: Line 28, Column 64, Reason: The file name "Backend-Mini-Browser.exe" declared for element "[local-name()='Applications']/[local-name()='Application']/[local-name()='Extensions']/[local-name()='Extension' and @Category='windows.fullTrustProcess']" doesn't exist in the package."

But my "Backend-Mini-Browser.exe" it's in the "..\bin\x64\Debug\AppX" folder and everything work inside Visual Studio 2017.

Here my appxmanifest:

<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10" IgnorableNamespaces="uap mp desktop rescap">
  <Identity Name="2579cda2-1e8c-48ee-829a-b1d276066cfe" Publisher="CN=Certimeter" Version="1.0.3.0" />
  <mp:PhoneIdentity PhoneProductId="2579cda2-1e8c-48ee-829a-b1d276066cfe" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
  <Properties>
    <DisplayName>Mini-browser</DisplayName>
    <PublisherDisplayName>Certimeter</PublisherDisplayName>
    <Logo>Assets\StoreLogo.png</Logo>
  </Properties>
  <Dependencies>
    <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
  </Dependencies>
  <Resources>
    <Resource Language="x-generate" />
  </Resources>
  <Applications>
    <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="Mini_browser.App">
    <uap:VisualElements DisplayName="Mini-browser" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="Mini-browser" BackgroundColor="transparent">
    <uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png">
    </uap:DefaultTile>
    <uap:SplashScreen Image="Assets\SplashScreen.png" />
  </uap:VisualElements>
  <Extensions>
    <desktop:Extension Category="windows.fullTrustProcess" Executable="Backend-Mini-Browser.exe" />
  </Extensions>
</Application>
 </Applications>
<Capabilities>
  <Capability Name="internetClient" />
  <uap:Capability Name="picturesLibrary" />
  <rescap:Capability Name="runFullTrust" />
</Capabilities>
</Package>

Here:

<rescap:Capability Name="runFullTrust" />

I have a warning: The element "Capabilities" in the namespace "http://schemas.microsoft.com/appx/manifest/foundation/windows10" has a not valid child "Capability" in the namespace "http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities". List of possible: "CapabilityChoice" in the namespace "http://schemas.microsoft.com/appx/manifest/foundation/windows10" and "Capability" in the namespace "http://schemas.microsoft.com/appx/manifest/uap/windows10" and "Capability" in the namespace "http://schemas.microsoft.com/appx/manifest/foundation/windows10" and "Capability" in the namespace "http://schemas.microsoft.com/appx/manifest/uap/windows10/4" and "Capability" in the namespace "http://schemas.microsoft.com/appx/manifest/uap/windows10/3" and "Capability" in the namespace "http://schemas.microsoft.com/appx/manifest/uap/windows10/2" and "CustomCapabilityChoice" in the namespace "http://schemas.microsoft.com/appx/manifest/foundation/windows10" and "CustomCapability" in the namespace "http://schemas.microsoft.com/appx/manifest/uap/windows10/4" and "DeviceCapability" in the namespace "http://schemas.microsoft.com/appx/manifest/foundation/windows10".

(this warning is traslated in english by me, but I don't think this is the main problem).

LiefLayer
  • 977
  • 1
  • 12
  • 29

1 Answers1

5

Two things you need to do:

1) place the full trust EXE in a subfolder of the package, not the package root

2) explicitly include the .EXE file in the UWP project

For #2, select "Show all files" in the solution explorer, then right click on the .EXE file and select "Include in project".

Here is an example you can compare with: https://github.com/Microsoft/DesktopBridgeToUWP-Samples/tree/master/Samples/UWP%20Systray

EDIT Updating my answer since the VS support has become much better for this type of scenario since I first answered this. I have produced a couple of blog posts and samples to further clarify how this can be done now with the latest updates to VS 2017:

https://stefanwick.com/2018/04/06/uwp-with-desktop-extension-part-1/

Stefan Wick MSFT
  • 13,600
  • 1
  • 32
  • 51
  • Thank you for your answer. I will try it right now, the reason why I answer now it's because I actually found a solution while I was waiting. https://stackoverflow.com/questions/38903012/error-while-creating-app-package-with-fulltrustprocess-pointing-to-a-executabl Mattias answer did work for me (but I didn't used the AppServiceBridgeSample namespace and I had to use the root folder not the bin folder). Anyway since it is a workaround I want to try your solution that I think it's more standard. I will accept it as soon as I know that it works. – LiefLayer Sep 28 '17 at 12:41
  • Ok I tried both 1 and 2 but I still get the same error. I really don't know why but since I find a solution I will just use that instead. Thank you anyway. – LiefLayer Sep 28 '17 at 12:49
  • Ok I don't know why this is not working for me, but it does the same thing. I decided to accept your answer since maybe it's just a bug. – LiefLayer Sep 28 '17 at 14:49
  • @spspli: I have updated my answer, also see here: https://stefanwick.com/2018/04/06/uwp-with-desktop-extension-part-1/ – Stefan Wick MSFT Apr 16 '18 at 23:31
  • Thanks Stefan! What would the best practice to add the executable as part of the UWP, I mean I have Win32 folder under UWP project, after my WPF project is built, shall I directly set the output path to UWP/Win32, or I should use post build event to copy all binaries and executables from output path to my Win32 folder? Is that possible if I use MSBuild to build my project, the post build event will happen after all projects are done built? – spspli Apr 16 '18 at 23:37
  • And my Win32 apps has a lot of dependencies, I used to write a post build event to copy both my executable and those dependencies to under the Win32 folder, it totally works in visual studio. But after I use MSBuild to build and pack my app, it complains cannot find my executable, but it is there under the Win32 folder. – spspli Apr 16 '18 at 23:45
  • @spspli: take a look at my blog post. You don't need to do the manual copying anymore. You can use the packaging project to do the heavy lifting. – Stefan Wick MSFT Apr 16 '18 at 23:58
  • Thank you Stefan, we will utilize the packaging project. Thanks! – spspli Apr 23 '18 at 16:57