Azure DevOps | UWP:DEP7100的测试任务:无法激活应用程序

Azure DevOps | UWP:DEP7100的测试任务:无法激活应用程序,uwp,azure-devops,automated-tests,azure-pipelines,Uwp,Azure Devops,Automated Tests,Azure Pipelines,我有一个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 1

我有一个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项目和测试项目的回购协议:

这是最后一次构建,您可以看到,有2个测试通过了(1个用于x84,1个用于x64):

这里是构建本身:

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

更新 我尝试了新事物:

1) 我用一个自托管代理创建了另一个分支,它叫
,带有自托管代理。最后一次构建在这里。作为自托管代理,我使用我的笔记本电脑。构建成功,但测试甚至没有运行(运气不佳):

2) 我改为只有x86体系结构。这里提供了针对唯一x86的构建(运气不好):

3) 在另一个名为_1.3.1_version的分支上尝试了版本1.3.1。与主分支的结果相同:测试正在运行,但生成失败。(运气不好):

Azure DevOps | UWP:DEP7100的测试任务:无法激活应用程序

根据错误日志:

[error]App activation failed.
[error]Failed to initialize client proxy: could not connect to test process.
您可以尝试在测试项目文件
.csproj
中执行以下步骤:

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

  • <PropertyGroup>
      <RestoreProjectStyle>PackageReference</RestoreProjectStyle>
    </PropertyGroup> 
    
    
    包装参考
    
    在测试项目文件中

查看更多详细信息

此外,我注意到您正在使用Microsoft托管代理构建项目,但根据文档:

使用时,可以从命令行生成通用Windows应用程序 Windows Server 2012 R2或Windows Server 2016

因此,我不确定我们是否可以在Windows Server 2019上运行UWP应用程序

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

希望这有帮助。

从这里开始:

结果是,有2个
.appxrecipe
文件。一个在发布文件夹中,另一个在上载文件夹中。上传文件夹中的那个失败了。因为这个构建失败了。所以这里的解决方案是只使用发布文件夹中的文件。 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)'
#通用Windows平台
#使用Visual Studio构建通用Windows平台项目。
#添加测试和分发应用程序、保存构建工件等步骤:
# https://aka.ms/yaml
触发:
-主人
游泳池:
vmImage:“windows最新版本”
变量:
解决方案:'***.sln'
构建平台:“x86 | x64”
buildConfiguration:“发布”
appxPackageDir:“$(build.artifactStagingDirectory)\AppxPackages\\”
步骤:
-任务:NuGetToolInstaller@1
-任务:NuGetCommand@2
投入:
恢复解决方案:“$(解决方案)”
-任务:VSBuild@1
投入:
平台:“x86”
解决方案:“$(解决方案)”
配置:“$(构建配置)”
msbuildArgs:“/p:AppxBundlePlatforms=“$(构建平台)”/p:AppxPackageDir=“$(AppxPackageDir)”/p:AppxBundle=Always/p:UAPAPPXPPackageBuildMode=StoreUpload”
-任务:VSTest@2
投入:
平台:“x86 | x64”
testSelector:“测试组件”
测试组件2:|

**\Release\UnitTestProject1.build.appxrecipe Hello。对不起,很久没有回复。我尝试了几件事:1)我用一个自托管代理创建了另一个分支,它叫
with_self_hosted_agent。最后一次构建在这里(运气不好):https://dev.azure.com/melashkina0755/UWP_App_With_Tests/_build/results?buildId=10
2)我改为仅使用x86体系结构。仅针对x86的构建在此(运气不佳):3)在另一个名为
的分支上试用了版本1.3.1,版本为
(运气不佳):