【问题标题】:Azure DevOps | Test Task for UWP: DEP7100: Failed to activate appAzure 开发运维 | UWP 的测试任务:DEP7100:无法激活应用程序
【发布时间】:2019-10-24 09:31:28
【问题描述】:

我有一个带有测试项目的 UWP 项目。本地测试通过。我为这些项目配置了 Azure DevOps 管道。测试也通过了 azure DevOps!但是测试任务失败并出现下一个错误:

DEP7100: Failed to activate app '748f39e5-19db-43a2-ba4a-fb4b137bdbf3_4r2k005x7atxw!vstest.executionengine.universal.App' with parameters '--port 50037 --endpoint 127.0.0.1:050037 --role client --parentprocessid 5044 --telemetryoptedin false'. The app didn't start.
The app didn't start.
DEP7100: Failed to activate app '748f39e5-19db-43a2-ba4a-fb4b137bdbf3_4r2k005x7atxw!vstest.executionengine.universal.App' with parameters '--port 50037 --endpoint 127.0.0.1:050037 --role client --parentprocessid 5044 --telemetryoptedin false'. The app didn't start.
The app didn't start.
App activation failed.
Failed to initialize client proxy: could not connect to test process.
DEP7100: Failed to activate app '748f39e5-19db-43a2-ba4a-fb4b137bdbf3_4r2k005x7atxw!vstest.executionengine.universal.App' with parameters '--port 50040 --endpoint 127.0.0.1:050040 --role client --parentprocessid 5044 --telemetryoptedin false'. The app didn't start.
The app didn't start.
DEP7100: Failed to activate app '748f39e5-19db-43a2-ba4a-fb4b137bdbf3_4r2k005x7atxw!vstest.executionengine.universal.App' with parameters '--port 50040 --endpoint 127.0.0.1:050040 --role client --parentprocessid 5044 --telemetryoptedin false'. The app didn't start.
The app didn't start.

在这里您可以找到包含 UWP 项目和测试项目的 repo:https://dev.azure.com/melashkina0755/UWP_App_With_Tests

这是最后一次构建,您可以看到,有 2 个测试通过(1 个用于 x84,1 个用于 x64): https://dev.azure.com/melashkina0755/UWP_App_With_Tests/_build/results?buildId=3&view=ms.vss-test-web.build-test-results-tab

这里是构建本身: https://dev.azure.com/melashkina0755/UWP_App_With_Tests/_build/results?buildId=3&view=logs

不确定我的配置有什么问题?

更新

我尝试了新事物:

1) 我创建了另一个带有自托管代理的分支,称为with_self_hosted_agent。最后一个版本在这里。作为自托管代理,我使用我的笔记本电脑。构建成功,但测试甚至没有运行(运气不好):https://dev.azure.com/melashkina0755/UWP_App_With_Tests/_build/results?buildId=10

2) 我只更改为 x86 架构。为唯一的 x86 构建在这里(运气不好):https://dev.azure.com/melashkina0755/UWP_App_With_Tests/_build/results?buildId=9

3) 在另一个名为 with_1.3.1_version 的分支上尝试了 1.3.1 版。与 master 分支相同的结果:测试正在运行,但构建失败。 (没运气): https://dev.azure.com/melashkina0755/UWP_App_With_Tests/_build/results?buildId=11

【问题讨论】:

    标签: uwp azure-devops automated-tests azure-pipelines


    【解决方案1】:

    从这里:https://github.com/MicrosoftDocs/vsts-docs/issues/6108

    原来,有 2 个.appxrecipe 文件。一个在 Release 文件夹中,另一个在 Upload 文件夹中。上传文件夹中的那个失败了。因为这个构建失败了。所以这里的解决方案是只使用 Release 文件夹中的文件。 YML 文件如下所示:

    # Universal Windows Platform
    # Build a Universal Windows Platform project using Visual Studio.
    # Add steps that test and distribute an app, save build artifacts, and more:
    # https://aka.ms/yaml
    
    trigger:
    - master
    
    pool:
      vmImage: 'windows-latest'
    
    variables:
      solution: '**/*.sln'
      buildPlatform: 'x86|x64'
      buildConfiguration: 'Release'
      appxPackageDir: '$(build.artifactStagingDirectory)\AppxPackages\\'
    
    steps:
    - task: NuGetToolInstaller@1
    
    - task: NuGetCommand@2
      inputs:
        restoreSolution: '$(solution)'
    
    - task: VSBuild@1
      inputs:
        platform: 'x86'
        solution: '$(solution)'
        configuration: '$(buildConfiguration)'
        msbuildArgs: '/p:AppxBundlePlatforms="$(buildPlatform)" /p:AppxPackageDir="$(appxPackageDir)" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload'
    
    - task: VSTest@2
      inputs:
        platform: 'x86|x64'
        testSelector: 'testAssemblies'
        testAssemblyVer2: |
          **\Release\UnitTestProject1.build.appxrecipe <-- HERE IS FIX
          !**\*TestAdapter.dll
          !**\obj\**
        searchFolder: '$(System.DefaultWorkingDirectory)'
    

    【讨论】:

      【解决方案2】:

      Azure 开发运维 | UWP 的测试任务:DEP7100:无法激活应用

      根据错误日志:

      [error]App activation failed.
      [error]Failed to initialize client proxy: could not connect to test process.
      

      您可以尝试在您的测试项目文件.csproj中执行以下步骤:

      • 将 PackageReference 更改为 MSTest.TestAdapterMSTest.TestFramework 到版本1.3.1

      • 添加

        <PropertyGroup>
          <RestoreProjectStyle>PackageReference</RestoreProjectStyle>
        </PropertyGroup> 
        

        在测试项目文件中。

      查看this thread了解更多详情。

      此外,我注意到您正在使用 Microsoft 托管代理来构建您的项目,但根据文档 Visual Studio 2019 Platform Targeting and Compatibility

      通用 Windows 应用程序可以在使用时从命令行构建 Windows Server 2012 R2 或 Windows Server 2016。

      所以,我不确定我们是否可以在 Windows Server 2019 上运行 UWP 应用。

      作为解决方法,您可以在 Windows 10 机器上构建自己的代理。

      希望这会有所帮助。

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-03-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-31
      • 2012-05-17
      相关资源
      最近更新 更多