JetBrains / TeamCity.VSTest.TestAdapter

Apache License 2.0
30 stars 14 forks source link

Identical .props file for both targets causes unneeded assembly in test project output #7

Closed bording closed 7 years ago

bording commented 7 years ago

Now that 1.0.1 is out and supports .NET Core 2.0, I tried to use it, but I've run into another issue.

Looking at how the package is constructed, you're including the same .props file for both targets:

https://github.com/JetBrains/TeamCity.VSTest.TestAdapter/blob/c906291b1fc9c6676acabbf8c02cb75d70cd2104/TeamCity.VSTest.TestLogger/package.nuspec#L25-L26

But that means you're including TeamCity.VSTest.TestLogger.dll and TeamCity.VSTest.net35.TestLogger.dll in the test output for both netcoreapp1.0 and net35:

https://github.com/JetBrains/TeamCity.VSTest.TestAdapter/blob/c906291b1fc9c6676acabbf8c02cb75d70cd2104/TeamCity.VSTest.TestLogger/TeamCity.VSTest.TestAdapter.props#L11-L15

https://github.com/JetBrains/TeamCity.VSTest.TestAdapter/blob/c906291b1fc9c6676acabbf8c02cb75d70cd2104/TeamCity.VSTest.TestLogger/TeamCity.VSTest.TestAdapter.props#L21-L25

My test projects do some assembly scanning/loading and having both assemblies is causing problems. Can you change the props files so that the net35 file includes only the net35 assembly, and the netcoreapp1.0 props file includes only the netcoreapp assembly?

NikolayPianikov commented 7 years ago

@bording It is an expected behavior and it is required to run tests using vstest.console.exe which does not support the Test Platform (for example to test net35;net40;net452 projects). Maybe it is already deprecated ... I am going to think about it tomorrow. But what is the reason to check testing assemblies? I mean in the common case these assemblies are not used as binary dependencies and might have any target framework.

bording commented 7 years ago

We have an assembly scanner in our project that looks for assemblies on disk and loads them dynamically at runtime. We have tests for this assembly scanner, and they are failing because they find both versions of the file, and then we get an error saying that the assembly has already been loaded when it attempts to load the second one it finds.

We have far too many tests impacted to try and exclude the file from scanning.

NikolayPianikov commented 7 years ago

@bording Now output dir contains assemblies with valid framework version See package v 1.0.2 But for msbuild 15 output contains 2 assemblies TeamCity.VSTest.TestLogger.dll and TeamCity.VSTest.TestAdapter.dll. MS changes regex to find loggers and I did not find any robust way to choose an appropriate name