stryker-mutator / stryker-net

Mutation testing for .NET core and .NET framework!
https://stryker-mutator.io
Apache License 2.0
1.75k stars 176 forks source link

DotNetCore 2.1 support #47

Closed richardwerkman closed 5 years ago

richardwerkman commented 6 years ago

On .NET Core 2.1 projects the build/dotnet-stryker.targets seems to be ignored. This file is being copied by msbuild in the other .NET Core versions.

An awesome feature is added in 2.1 called DotnetTools. This can be used to create global tools like with npm npm i -g

To support DotnetTool a new package has to be created with the type DotnetTool. This could also be added within the current CLI package.

For now the CLI seems to be broken on 2.1. To fix this users can copy the task by hand:

  <Target Name="PrintReferences" DependsOnTargets="ResolveProjectReferences;ResolveAssemblyReferences">
    <Message Text="@(_ResolveAssemblyReferenceResolvedFiles)" Importance="high" />
  </Target>

Into their test .csproj file

richardwerkman commented 6 years ago

An example DotnetTool application: https://github.com/dotnet/core/blob/master/samples/dotnetsay/README.md

nicojs commented 6 years ago

On .NET Core 2.1 projects the build/dotnet-stryker.targets seems to be ignored. This file is being copied by msbuild in the other .NET Core versions.

Did you ever find out why this is? If not, let's create an issue over at the dotnet cli: https://github.com/dotnet/cli

nicojs commented 5 years ago

I just reproduced this issue on dotnet core 2.0, indicating that this is not related to 2.1 (which is a good thing!)

@richardwerkman I think I might know what the problem is. The targets file in the build directory is called dotnet-stryker.targets. Maybe this should be the name of your nuget dependency? So it should be called StrykerMutator.DotNetCoreCli.targets ?

richardwerkman commented 5 years ago

@nicojs I tried to test this locally but that didn't work out. In microsofts documentation it indeed says to name the targets file after the package-id. So I tried to release a new package with a targets file called: StrykerMutator.DotNetCoreCli.targets.

Using this package I've succesfully used stryker on a dotnetcore2.1 application without placing the task myself in the .csproj file.

It seems your thought was right. I will create a pull request to close this issue.

legopiraat commented 5 years ago

@richardwerkman What is the status of this issue?

richardwerkman commented 5 years ago

@legopiraat This issue will be closed by #112. I updated the PR a few days ago so it will only rename the targets file. The issue does not exist in the latest version on NuGet since I already released it. The pull request should be merged to ensure the issue will not return in future versions.