1

I wrote a .Net Core app and an C# UWP app, which uses FullTrustProcessLauncher to run the first app. When I use xcopy for the executable of the first app in Postbuild of the UWP app, the executable is added to Appx directory and can be executed from the UWP app. But if I publish the UWP with Visual Studio 2019, the first app is not included in the AppPackage.

I tried also to add the executable directly in the UWP project with content and copy ever property but that does also not work :(

Additionally, I tried to create a Windows Application Packaging Project and added a reference for both projects, but as I tried to start the first app an exception for an invalid manifest of the Appx-package was thrown.

Can anyone tell me what I have to do fix that problem?

istepaniuk
  • 4,016
  • 2
  • 32
  • 60
Wolfgang Wieser
  • 111
  • 1
  • 9
  • Is the .Net Core app you created Console App(.Net Core)? In addition, when you tried to create a Windows Application Packaging Project, did you declare the extension about fullTrustProcess in the package manifest of Windows Application Packaging Project or just declare it in your UWP app? – Faywang - MSFT Jul 02 '20 at 06:46

2 Answers2

0

It seems that you didn't add first app exe into the package project.

  1. create a folder in package project named dotnetapp to store first app exe
  2. xcopy first app exe and related dll or somethingelse in postbuild of first app into folder dotnetapp
  3. go to the folder and run first app and make sure it runs normally
  4. make every files in dotnetapp "always copy" in package project
  5. Add Category="windows.fullTrustProcess" and Executable="firstApp.exe" in Package.appxmanifest
  6. LaunchFullTrustProcessForCurrentAppAsync in uwp
  7. publish and install it
  8. check C:\Program Files\WindowsApps\package_series_name\dotnetapp, make sure your first app exists

It should work fine. if not, check https://github.com/vincent1000/uwp-call-win32 for sample.

vincent
  • 81
  • 6
0

thank you for your response. I tried that, but when I run the UWP app via Visual Studio firstApp.exe was missing in AppX. Thus I use two xcopy commands to copy the 5 files (firstApp.exe, firstApp.dll, firstApp.pdb, , firstApp.runtimeconfig.dev.json and firstApp.runtimeconfig.json) also into the AppX and the dotnetapp directory.

xcopy /Y $(ProjectDir)firstApp\bin\$(ConfigurationName)\netcoreapp3.1\firstApp.* $(TargetDir)AppX\
xcopy /Y $(ProjectDir)firstApp\bin\$(ConfigurationName)\netcoreapp3.1\firstApp.* $(TargetDir)\..\..\..\dotnetapp

After that the UWP app again was able to start firstApp. But when I generate the app package I get following messages:

  • 5 file(s) copied
  • MakeAppx : error : Manifest validation error: Line 29, Column 64, Reason: The file name "firstApp.exe" declared for element "[local-name()='Applications']/[local-name()='Application']/[local-name()='Extensions']/[local-name()='Extension' and not(@Category='windows.backgroundTasks' or @Category='windows.appService')]" doesn't exist in the package.
  • MakeAppx : error : Manifest validation error: Line 29, Column 64, Reason: The file name "firstApp.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.
  • MakeAppx : error : Package creation failed.
  • MakeAppx : error : 0x80080204 - The specified package format is not valid: The package manifest is not valid.

After failed package generation I looked into the AppX folder and saw, that it also contains the dotnetapp directory. So I changed Executable="firstApp.exe" to Executable="dotnetapp/firstApp.exe" and tried it again and it worked!

After that I added

xcopy /Y $(ProjectDir)OpenMVGPipeline\bin\$(ConfigurationName)\netcoreapp3.1\firstApp.* $(TargetDir)\..\..\..\dotnetapp

to <PreBuildEvent> and replaced the two <PostBuildEvent> entries by

xcopy /Y $(TargetDir)\..\..\..\dotnetapp $(TargetDir)AppX\

Thank you very much for your help!

Wolfgang Wieser
  • 111
  • 1
  • 9