Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
848 views
in Technique[技术] by (71.8m points)

running a UWP test project in azure devops fails due to missing AppxManifest under ilc folder

?Hi

I am using windows-2019 agent with this step:

- task: VSTest@2
  displayName: Run UnitTests
  inputs:
    testSelector: 'testAssemblies'
    testAssemblyVer2: |
      **/Release/x64/UnitTests.build.appxrecipe
    searchFolder: '$(Pipeline.Workspace)'

in the log, I can see it's launching the test with something like this:

 vstest.console.exe "D:a1dropReleasex64UnitTests.build.appxrecipe"  

Next, it fails with this error:

[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:a1sdropReleasex64ilcAppxManifest.xml'. ##[debug]Processed: ##vso[task.logissue type=error;]Failed to launch testhost with error: System.AggregateException: One or more errors occurred.

I am not sure why it is happening, because in my local machine, I can run vstest.console.exe against the appxreceipt that is built from my local environment.

I do not have the ilc subfolder locally. The AppxManifest.xml is actually in the same folder as the appxrecipe file, why is Azure Devops looking for it in a subfolder?

The unit test runs and passes locally, but just can't run in azure devops. Anyone knows about this error message? Thanks


Update

Later I copied from another folder, so now the test run folder has a ilc subfolder with the AppxManifest.xml. I printed the entire directory tree and I can see the file.

Unfortunately, I am still seeing the error:

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:a1sdropReleasex86UnitTestsilcAppxManifest.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:a1sdropReleasex86UnitTestsilcAppxManifest.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 ---

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

vstest.console.exe "D:a1dropReleasex64UnitTests.build.appxrecipe"

The VSTest task is executing the unit test in the Build Artifacts folder.

Based on my test, AppxManifest.xml will not be pushed to the artifacts folder after build step, it will exist in the source directory -> bin folder (same folder as the appxrecipe file).

enter image description here

So you could try to change the searchFolder as $(System.DefaultWorkingDirectory).

Here is my yaml sample:

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: |
      **ReleaseUnitTestProject1.build.appxrecipe
      !***TestAdapter.dll
      !**obj**
    searchFolder: '$(System.DefaultWorkingDirectory)'

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...