在azure devops中运行UWP测试项目失败,因为ilc文件夹下缺少AppxManifest

在azure devops中运行UWP测试项目失败,因为ilc文件夹下缺少AppxManifest,uwp,azure-devops,Uwp,Azure Devops,​嗨 我正在使用windows-2019代理执行以下步骤: - task: VSTest@2 displayName: Run UnitTests inputs: testSelector: 'testAssemblies' testAssemblyVer2: | **/Release/x64/UnitTests.build.appxrecipe searchFolder: '$(Pipeline.Workspace)' 在日志中,我可以看到它正在启

​嗨

我正在使用
windows-2019
代理执行以下步骤:

- task: VSTest@2
  displayName: Run UnitTests
  inputs:
    testSelector: 'testAssemblies'
    testAssemblyVer2: |
      **/Release/x64/UnitTests.build.appxrecipe
    searchFolder: '$(Pipeline.Workspace)'
在日志中,我可以看到它正在启动测试,如下所示:

 vstest.console.exe "D:\a\1\drop\Release\x64\UnitTests.build.appxrecipe"  
接下来,它将失败并出现以下错误:

[错误]无法启动testhost,错误为:System.AggregateException:发生一个或多个错误。-->System.IO.DirectoryNotFoundException:找不到路径“D:\a\1\s\drop\Release\x64\ilc\AppxManifest.xml”的一部分##[调试]已处理:##vso[task.logissue type=error;]无法启动testhost,错误为:System.AggregateException:发生一个或多个错误

我不知道为什么会发生这种情况,因为在我的本地计算机上,我可以对从本地环境构建的AppxReceive运行
vstest.console.exe

我没有本地的ilc子文件夹。AppxManifest.xml实际上与appxrecipe文件位于同一文件夹中,为什么Azure Devops要在子文件夹中查找它

单元测试在本地运行并通过,但不能在azure devops中运行。 有人知道这个错误消息吗? 谢谢


更新

后来我从另一个文件夹复制,所以现在测试运行文件夹有一个子文件夹AppxManifest.xml。我打印了整个目录树,我可以看到文件

不幸的是,我仍然看到错误:

2021-01-04T18:02:16.4168648Z ##[error]Failed to launch testhost with error: System.AggregateException: One or more errors occurred. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\a\1\s\drop\Release\x86\UnitTests\ilc\AppxManifest.xml'.
2021-01-04T18:02:16.4171040Z ##[debug]Processed: ##vso[task.logissue type=error;]Failed to launch testhost with error: System.AggregateException: One or more errors occurred. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\a\1\s\drop\Release\x86\UnitTests\ilc\AppxManifest.xml'.
2021-01-04T18:02:16.4179397Z ##[error]   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
2021-01-04T18:02:16.4180905Z ##[debug]Processed: ##vso[task.logissue type=error;]   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
2021-01-04T18:02:16.4183043Z ##[error]   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
2021-01-04T18:02:16.4184829Z ##[debug]Processed: ##vso[task.logissue type=error;]   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
2021-01-04T18:02:16.4187337Z ##[error]   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
2021-01-04T18:02:16.4188735Z ##[debug]Processed: ##vso[task.logissue type=error;]   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
2021-01-04T18:02:16.4191848Z ##[error]   at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
2021-01-04T18:02:16.4193331Z ##[debug]Processed: ##vso[task.logissue type=error;]   at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
2021-01-04T18:02:16.4199669Z ##[error]   at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
2021-01-04T18:02:16.4201095Z ##[debug]Processed: ##vso[task.logissue type=error;]   at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
2021-01-04T18:02:16.4203263Z ##[error]   at System.Xml.XmlTextReaderImpl.FinishInitUriString()
2021-01-04T18:02:16.4204425Z ##[debug]Processed: ##vso[task.logissue type=error;]   at System.Xml.XmlTextReaderImpl.FinishInitUriString()
2021-01-04T18:02:16.4212719Z ##[error]   at System.Xml.XmlTextReaderImpl..ctor(String uriStr, XmlReaderSettings settings, XmlParserContext context, XmlResolver uriResolver)
2021-01-04T18:02:16.4214161Z ##[debug]Processed: ##vso[task.logissue type=error;]   at System.Xml.XmlTextReaderImpl..ctor(String uriStr, XmlReaderSettings settings, XmlParserContext context, XmlResolver uriResolver)
2021-01-04T18:02:16.4219038Z ##[error]   at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
2021-01-04T18:02:16.4220367Z ##[debug]Processed: ##vso[task.logissue type=error;]   at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
2021-01-04T18:02:16.4223912Z ##[error]   at System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext)
2021-01-04T18:02:16.4225961Z ##[debug]Processed: ##vso[task.logissue type=error;]   at System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext)
2021-01-04T18:02:16.4227028Z ##[error]   at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
2021-01-04T18:02:16.4228461Z ##[debug]Processed: ##vso[task.logissue type=error;]   at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
2021-01-04T18:02:16.4229380Z ##[error]   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.AppxManifestFile.ReadTargetPlatformVersions()
2021-01-04T18:02:16.4230291Z ##[debug]Processed: ##vso[task.logissue type=error;]   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.AppxManifestFile.ReadTargetPlatformVersions()
2021-01-04T18:02:16.4231242Z ##[error]   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.AppxManifestFile.get_TargetPlatformVersion()
2021-01-04T18:02:16.4232033Z ##[debug]Processed: ##vso[task.logissue type=error;]   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.AppxManifestFile.get_TargetPlatformVersion()
2021-01-04T18:02:16.4232939Z ##[error]   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.RecipeFile.get_TargetPlatformVersion()
2021-01-04T18:02:16.4233716Z ##[debug]Processed: ##vso[task.logissue type=error;]   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.RecipeFile.get_TargetPlatformVersion()
2021-01-04T18:02:16.4234953Z ##[error]   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.Deployer.Microsoft.VisualStudio.UwpTestHostRuntimeProvider.IDeployer.get_TargetPlatformVersion()
2021-01-04T18:02:16.4235974Z ##[debug]Processed: ##vso[task.logissue type=error;]   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.Deployer.Microsoft.VisualStudio.UwpTestHostRuntimeProvider.IDeployer.get_TargetPlatformVersion()
2021-01-04T18:02:16.4236919Z ##[error]   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.UwpTestHostManager.<LaunchHostAsync>d__38.MoveNext()
2021-01-04T18:02:16.4237698Z ##[debug]Processed: ##vso[task.logissue type=error;]   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.UwpTestHostManager.<LaunchHostAsync>d__38.MoveNext()
2021-01-04T18:02:16.4238493Z ##[error]--- End of stack trace from previous location where exception was thrown ---
2021-01-04T18:02:16.4239155Z ##[debug]Processed: ##vso[task.logissue type=error;]--- End of stack trace from previous location where exception was thrown ---
2021-01-04T18:02:16.4239936Z ##[error]   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2021-01-04T18:02:16.4240675Z ##[debug]Processed: ##vso[task.logissue type=error;]   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2021-01-04T18:02:16.4241737Z ##[error]   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2021-01-04T18:02:16.4242520Z ##[debug]Processed: ##vso[task.logissue type=error;]   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2021-01-04T18:02:16.4243715Z ##[error]   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.UwpTestHostManager.<Microsoft-VisualStudio-TestPlatform-ObjectModel-Host-ITestRuntimeProvider-LaunchTestHostAsync>d__30.MoveNext()
2021-01-04T18:02:16.4244732Z ##[debug]Processed: ##vso[task.logissue type=error;]   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.UwpTestHostManager.<Microsoft-VisualStudio-TestPlatform-ObjectModel-Host-ITestRuntimeProvider-LaunchTestHostAsync>d__30.MoveNext()
2021-01-04T18:02:16.4245637Z ##[error]   --- End of inner exception stack trace ---
2021-01-04T18:02:16.4168648Z##[错误]无法启动testhost,错误为:System.AggregateException:出现一个或多个错误。-->System.IO.DirectoryNotFoundException:找不到路径“D:\a\1\s\drop\Release\x86\UnitTests\ilc\AppxManifest.xml”的一部分。
2021-01-04T18:02:16.4171040Z###[调试]已处理:##vso[task.logissue type=error;]无法启动测试主机,错误为:System.AggregateException:发生一个或多个错误。-->System.IO.DirectoryNotFoundException:找不到路径“D:\a\1\s\drop\Release\x86\UnitTests\ilc\AppxManifest.xml”的一部分。
2021-01-04T18:02:16.4179397Z##[error]位于System.IO.#u error.WinIOError(Int32 errorCode,字符串maybeFullPath)
2021-01-04T18:02:16.4180905Z###[debug]已处理:##vso[task.logissue type=error;]at System.IO.u error.WinIOError(Int32 errorCode,字符串maybeFullPath)
2021-01-04T18:02:16.4183043Z##[错误]位于System.IO.FileStream.Init(字符串路径、文件模式、文件访问权限、Int32权限、布尔用户名、文件共享、Int32缓冲大小、文件选项选项、安全属性secAttrs、字符串msgPath、布尔bFromProxy、布尔useLongPath、布尔checkHost)
2021-01-04T18:02:16.4184829Z###[debug]已处理:##vso[task.logissue type=error;]at System.IO.FileStream.Init(字符串路径、文件模式、文件访问权限、Int32权限、布尔用户权限、文件共享、Int32 bufferSize、文件选项选项、安全属性secAttrs、字符串msgPath、布尔bFromProxy、布尔useLongPath、布尔checkHost)
2021-01-04T18:02:16.4187337Z##[error]位于System.IO.FileStream..ctor(字符串路径、文件模式、文件访问访问、文件共享、Int32缓冲区大小)
2021-01-04T18:02:16.4188735Z###[debug]已处理:##vso[task.logissue type=error;]at System.IO.FileStream..ctor(字符串路径、文件模式、文件访问访问、文件共享、Int32缓冲区大小)
2021-01-04T18:02:16.4191848Z###[错误]位于System.Xml.XmlDownloadManager.GetStream(Uri Uri、ICredentials凭据、IWebProxy代理、RequestCachePolicy cachePolicy)
2021-01-04T18:02:16.4193331Z###[调试]已处理:##vso[task.logissue type=error;]位于System.Xml.XmlDownloadManager.GetStream(Uri Uri、ICredentials凭据、IWebProxy代理、RequestCachePolicy cachePolicy)
2021-01-04T18:02:16.4199669Z##[错误]位于System.Xml.XmlUrlResolver.GetEntity(Uri绝对Uri,字符串角色,对象类型返回)
2021-01-04T18:02:16.4201095Z###[调试]已处理:##vso[task.logissue type=error;]位于System.Xml.XmlUrlResolver.GetEntity(Uri绝对Uri,字符串角色,对象类型返回)
2021-01-04T18:02:16.4203263Z###[错误]位于System.Xml.XmlTextReaderImpl.FinishInitUriString()处
2021-01-04T18:02:16.4204425Z###[debug]已处理:##vso[task.logissue type=error;]at System.Xml.XmlTextReaderImpl.FinishInitUriString()
2021-01-04T18:02:16.4212719Z##[错误]位于System.Xml.XmlTextReaderImpl..ctor(字符串URI、XmlReaderSettings设置、XmlParserContext上下文、XmlResolver uriResolver)
2021-01-04T18:02:16.4214161Z###[debug]已处理:##vso[task.logissue type=error;]at System.Xml.XmlTextReaderImpl..ctor(字符串URI、XmlReaderSettings设置、XmlParserContext上下文、XmlResolver uriResolver)
2021-01-04T18:02:16.4219038Z###[错误]位于System.Xml.XmlReaderSettings.CreateReader(字符串输入URI,XmlParserContext输入上下文)
2021-01-04T18:02:16.4220367Z###[调试]已处理:###vso[task.logissue type=error;]at System.Xml.XmlReaderSettings.CreateReader(字符串inputUri,XmlParserContext inputContext)
2021-01-04T18:02:16.4223912Z###[错误]位于System.Xml.XmlReader.Create(字符串输入URI、XmlReaderSettings设置、XmlParserContext输入上下文)
2021-01-04T18:02:16.4225961Z###[调试]已处理:##vso[task.logissue type=error;]at System.Xml.XmlReader.Create(字符串输入URI、XmlReaderSettings设置、XmlParserContext输入上下文)
2021-01-04T18:02:16.4227028Z##[错误]位于System.Xml.Linq.XDocument.Load(字符串uri,加载选项)
2021-01-04T18:02:16.4228461Z###[debug]已处理:##vso[task.logissue type=error;]at System.Xml.Linq.XDocument.Load(字符串uri,LoadOptions)
2021-01-04T18:02:16.4229380Z###[错误]位于Microsoft.VisualStudio.UwpTestHostRuntimeProvider.AppxManifestFile.ReadTargetPlatformVersions()
2021-01-04T18:02:16.4230291Z###[调试]已处理:###vso[task.logissue type=error;]位于Microsoft.VisualStudio.UwpTestHostRuntimeProvider.AppxManifestFile.ReadTargetPlatformVersions()
2021-01-04T18:02:16.423124Z###[错误]位于Microsoft.VisualStudio.UwpTestHostRuntimeProvider.AppxManifestFile.get_TargetPlatformVersion()
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
      !**\*TestAdapter.dll
      !**\obj\**
    searchFolder: '$(System.DefaultWorkingDirectory)'