Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Adding the references and satellite assemblies to the deployment items list" doesn't copy all references #3679

Closed
decriptor opened this issue Aug 22, 2024 · 6 comments

Comments

@decriptor
Copy link

The tl;dr; is that the unmanaged references from nuget packages aren't copied to the TestResults\Deploy_***\out directory.

In my case, I'm trying to test my ML library that uses the Microsoft.ML.OnnxRuntime.DirectML nuget:
image

My unit tests run and pass if I run them in Visual Studio or use the new mstest nugets that generate {AssemblyName}.exe. If I try to run them from the console (and CI) using vstest.console.exe it fails to load the native assemblies.

From what I can tell so far, when vstest.console.exe runs it tries to find all of the references and copy them to the out folder it finds the managed references from the nugets. ie,

DeploymentManager: Reference:D:\source\X\tests\X\Y.ML.Tests\bin\Debug\net472\OpenCvSharp.dll 
DeploymentManager: Reference:D:\source\X\tests\X\Y.ML.Tests\bin\Debug\net472\Microsoft.ML.OnnxRuntime.dll

image

vstest.console.exe, Adding the references and satellite assemblies to the deployment items list
vstest.console.exe, AssemblyDependencyFinder.GetDependentAssemblies: start.
vstest.console.exe, UnitTestAdapter: Using configuration file D:\source\X\tests\X\Y.ML.Tests\bin\Debug\net472\Y.ML.Tests.exe.config to setup appdomain for test source Y.ML.Tests.exe.
vstest.console.exe, AssemblyDependencyFinder.GetDependentAssemblies: Using config file: 'D:\source\X\tests\X\Y.ML.Tests\bin\Debug\net472\Y.ML.Tests.exe.config'.
vstest.console.exe, AssemblyDependencyFinder.GetDependentAssemblies: Created AppDomain.
vstest.console.exe, AssemblyDependencyFinder.GetDependentAssemblies: loaded the worker.
vstest.console.exe, AssemblyDependencyFinder.GetDependentAssemblies: unloading AppDomain...
vstest.console.exe, AssemblyDependencyFinder.GetDependentAssemblies: unloading AppDomain succeeded.
vstest.console.exe, DeploymentManager: Source:D:\source\X\tests\X\Y.ML.Tests\bin\Debug\net472\Y.ML.Tests.exe has following references

However, things like onnxruntime.dll or OpenCvSharpExtern.dll are not copied over to the out folder.

I haven't had much luck trying to google. I'm hoping that I'm missing something simple.

@decriptor
Copy link
Author

I've worked around this by adding this to my test case:
[DeploymentItem(@"onnxruntime.dll")]
[DeploymentItem(@"onnxruntime.lib")]
[DeploymentItem(@"OpenCvSharpExtern.dll")]

@Evangelink
Copy link
Member

Hi @decriptor,

I will investigate the issue (most likely next week).

@Evangelink
Copy link
Member

@decriptor is moving to the new platform (MSTest runner - what you called {AssemblyName}.exe) a possiblity? There is a class of issues that are really hard to fix with VSTest platform and we are not actively investing into it when there is a viable solution with the new platform.

@decriptor
Copy link
Author

@Evangelink I think so. Is the future {AssemblyName}.exe and vstest.console.exe will be deprecated?

Our current situation is that we moved as many projects as we could to sdk projects and then netstandard2.0 as much as possible. We are slowly trying to migration from net472 to net8.0 (or whatever is current when we get there). Also, we are trying to upgrade from Azure DevOps 2020 server to at least Azure DevOps 2022 server.

@Evangelink
Copy link
Member

vstest.console.exe will be deprecated?

This would be an ideal but this is for sure going to take years.

The new platform (MSTest runner) doesn't require SDK style project (when you have it, it's easier as you can rely on MSTest.Sdk that greatly simplifies your project).

Would it be possible for you to create a small repro that I could use and debug to really pin point the issue and see what's possible on my end.

@Evangelink
Copy link
Member

Closing as cannot repro.

@Evangelink Evangelink closed this as not planned Won't fix, can't repro, duplicate, stale Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants