Error while creating app package with “fullTrustProcess” pointing to a executable

后端 未结 4 1043
悲&欢浪女
悲&欢浪女 2021-02-02 15:52

I am trying to deploy the sample application for bridging AppServices with a UWP application. The sample runs and builds just fine but when I try to follow the guide to package

4条回答
  •  遥遥无期
    2021-02-02 16:25

    I am posting here because I found my own answer after several hours of investigation. Hopefully, this will help others in the future!

    So the problem is that the BackgroundProcess.exe is not included in the project when building the package. Which files to be included in the project is defined in the .csproj file. Open it in your preferred text editor (remember to close Visual Studio before)

    Add where the assets are defined:

    
      
      
      
      
      
      
      
      
    
    

    To something like this:

    
      
      
      
      
      
      
      
      
      
        Always
      
    
    

    Note that I have added AppServiceBridgeSample.BackgroundProcces.exe ass the namespace of the file. I don't know if this is completely necessary but this is how I fixed it. So to fix the namespace you have to add AppServiceBridgeSample before all the classes. And also in the properties of the BackgroundProcess project under Application > Assembly name & Default namespace add the extension.

    Example class:

    namespace AppServiceBridgeSample.BackgroundProcess
    {
        class Program
        {
        ....
        }
    }
    

    And .xaml example:

    
      ...
    
    

    Also this does not automaticly fix the error I was having, you also have to add a Build Event, right click on BackgroundProcess (project in VS) > properties > Build Events > Under Post-Build events command line add:

    xcopy /y /s "$(TargetPath)" "$(SolutionDir)UWP"
    

    Build and Deploy the solution and the AppServiceBridgeSample.BackgroundProcess.exe file should be present in the UWP project root (visible in file explorer).

    Also, I updated to Visual Studio 15 Enterprise Preview 3 during this investigation which maybe also helped somewhat if you would encounter other errors.

提交回复
热议问题