nunit / nunit3-vs-adapter

NUnit 3.0 Visual Studio test adapter for use under VS 2012 or later
https://nunit.org
MIT License
203 stars 105 forks source link

VS22 seems to be ignoring settings defined in the settings file #1132

Closed apreshel closed 10 months ago

apreshel commented 1 year ago

I am try to run NUnit test for a dotnet core solution via VS22 test explorer. All the solution outputs are copied (via script) to P:\Bin, which is my binary deployment folder. The test run from VS explorer, but it returns a runtime failure that it failed to find dependency dlls, which suggest that it's trying to run from the local output folder of the NUnit project, and not from the binary output folder which I defined in the settings file `x64

P:\Bin P:\Bin net7.0` While the settings file is selected properly in Test->Configure Run Settings VS22 version is 17.6.5
mikkelbu commented 11 months ago

@apreshel Sorry we have overlooked this issue. Is this issue really for NUnit2 or should we move it to the https://github.com/nunit/nunit3-vs-adapter repository?

apreshel commented 11 months ago

It's for NUnit 3 (using the last NUnit 3 adapter from NuGet)

mikkelbu commented 11 months ago

I've moved the issue to nunit3-vs-adapter

OsirisTerje commented 11 months ago

@apreshel

  1. Can you please upload a repro project?

You can a) Add it as a PR to https://github.com/nunit/nunit3-vs-adapter.issues, add it as a separate folder named IssueXXX where the XXX is the issue number, or b) Add it as a zipped attachment here , or c) Add it to your own repo and just post the link.

Make it as small as you can, it should compile "as is".

  1. When you look at the test projects properties, does it point to your P:\Bin folder?
apreshel commented 11 months ago

I assume Issue ID will still be #1132, right?

OsirisTerje commented 11 months ago

Yes

The repro repo above is just for the code.

apreshel commented 11 months ago

Unfortunately the corporate IT blocks this action. I'm attaching it as a zip though Issue1132.zip

OsirisTerje commented 11 months ago

Not sure why you need to copy the same files as being copied by the csproj file itself though. Here those copies fail - not exactly sure why, but since they're not needed, removing that script makes the tests run, and they then run from the c:\temp\bin directory. And they run both with and without the runsettings file.

Also, the settings you have here in the runsettings file only adds more paths to the same bin folder, again, I can't see why you need them.

Also, you refer to a "local bin folder for the NUNit project", as far as I can see there is no such one, and that is to beexpected since in the csproj you have <OutputPath>c:\temp\bin</OutputPath>

Might be missing some more specific thing you're looking for. If that's the case, please elaborate.

I also see that you have specified paths several places, are you quite sure you need all of those paths? It is normally better to just use the default settings, and not try to force too much.
Anyway, without the script, it works as it should here

UPDATE: The script tries to copy the file to itself, that is probably the reason it fails. TargetDir == OutBinFolder

Repro here: https://github.com/nunit/nunit3-vs-adapter.issues/tree/master/Issue1132