JetBrains / TeamCity.VSTest.TestAdapter

Apache License 2.0
30 stars 14 forks source link

support for .net core 3 #34

Closed elitastic closed 4 years ago

elitastic commented 5 years ago

Could you please add support for .net core 3?

When I use ".net core 3.0.0-preview8" to build I have the same issue like described in https://github.com/JetBrains/TeamCity.VSTest.TestAdapter/issues/31:

Could not find a test logger with AssemblyQualifiedName, URI or FriendlyName 'teamcity'

NikolayPianikov commented 5 years ago

@elitastic could you add a sample to reproduce? Also could you run dotnet --info

elitastic commented 5 years ago

See below the output from dotnet --info.

I think it needs the same fix as you created to support vs 2019 https://github.com/JetBrains/TeamCity.VSTest.TestAdapter/commit/9e25b799623f6a67c48f309d6b83f2364d06bd01 but this time for MSBuildToolsVersion 16 instead of 15:

Looks like the problem is that "TeamCity.VSTest.TestLogger.dll" is not copied to output, when building with msbuild from .net core 3.

.NET Core SDK (gemäß "global.json"):
 Version:   3.0.100-preview8-013656
 Commit:    8bf06ffc8d

Laufzeitumgebung:
 OS Name:     Windows
 OS Version:  10.0.18362
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.0.100-preview8-013656\

Host (useful for support):
  Version: 3.0.0-preview8-28405-07
  Commit:  d01b2fb7bc

.NET Core SDKs installed:
  2.1.508 [C:\Program Files\dotnet\sdk]
  2.2.108 [C:\Program Files\dotnet\sdk]
  2.2.401 [C:\Program Files\dotnet\sdk]
  3.0.100-preview8-013656 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0-preview8.19405.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview8-28405-07 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.0.0-preview8-28405-07 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
NikolayPianikov commented 5 years ago

@elitastic I cannot reproduce this issue. Looks like TeamCity.VSTest.TestAdapter.props contains correct logic for the case when '$(MSBuildToolsVersion)' == '16.0'. Try the following script to check it:

md sample
pushd sample
dotnet new mstest
dotnet add package TeamCity.VSTest.TestAdapter
SET TEAMCITY_VERSION=2019.2
dotnet test
popd
rd sample /S /Q

You will see TeamCity service messages like ##teamcity[

elitastic commented 5 years ago

You're right, it works when you set the TEAMCITY_VERSION environment variable before building the project. Teamcity is not installed on my local machine that's why it didn't work. Please note that it works without setting TEAMCITY_VERSION environment when building with .net core < 3.0.

NikolayPianikov commented 5 years ago

it should not produce TeamCity service messages when it is not running under TeamCity. When we are specifying SET TEAMCITY_VERSION=2019.2 we just emulate a running under TeamCity

I've tried the following script for dotnet core 2.2.401 and it does not produce service messages if we does not set TEAMCITY_VERSION:

md sample
pushd sample
dotnet new globaljson --sdk-version 2.2.401
dotnet new mstest
dotnet add package TeamCity.VSTest.TestAdapter
rem SET TEAMCITY_VERSION=2019.2
dotnet test
popd
rd sample /S /Q
NikolayPianikov commented 5 years ago

@elitastic Could you provide some script to reproduce your issue?

elitastic commented 5 years ago

dotnet vstest xy.dll --logger:teamcity

This command fails when building with dotnet >= 3.0 but works with dotnet < 3.0 even when not running on teamcity. But it's fine for me, I changed my gulp script that it only specifies --logger:teamcity when running on teamcity.

NikolayPianikov commented 5 years ago

I am not sure it is possible. Try add the command dotnet clean before. And the behaviour should be the same. Could you check that files like

TeamCity.ServiceMessages.dll
TeamCity.VSTest.TestAdapter.dll
TeamCity.VSTest.TestLogger.dll

exist before you are running tests These files should be restored when build is under TeamCity or when SET TEAMCITY_VERSION=... for any framework

AntonSmolkov commented 4 years ago

@elitastic I cannot reproduce this issue. Looks like TeamCity.VSTest.TestAdapter.props contains correct logic for the case when '$(MSBuildToolsVersion)' == '16.0'. Try the following script to check it:

md sample
pushd sample
dotnet new mstest
dotnet add package TeamCity.VSTest.TestAdapter
SET TEAMCITY_VERSION=2019.2
dotnet test
popd
rd sample /S /Q

You will see TeamCity service messages like ##teamcity[

Dotnet test and Dotnet vstest /path/to/file.dll /Logger:teamcity /TestAdapterPath:. both work with dotnet 3.0.100. But please replace gif on the README.md to metioned commands snippet. Spent 40 minutes to figure out that example does not work because of absence TEAMCITY_VERSION envinronmet variable.

NikolayPianikov commented 4 years ago

@antonarhipov I've added notes under the demo video.