-
Notifications
You must be signed in to change notification settings - Fork 88
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
Multitool: Enable cross-platform "dotnet tool" support #1474
Conversation
@@ -10,10 +10,8 @@ branches: | |||
- tc-31 | |||
- sarif-v1 | |||
|
|||
platform: Any CPU |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dropping this is per recommendation from AppVeyor for dotnet test
compatibility
@@ -34,27 +34,15 @@ Import-Module -Force $PSScriptRoot\Projects.psm1 | |||
|
|||
$ScriptName = $([io.Path]::GetFileNameWithoutExtension($PSCommandPath)) | |||
|
|||
$ReporterOption = $null | |||
if ($AppVeyor) { | |||
$ReporterOption = "-appveyor" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is dropped without replacement because xunit automatically detects this nowadays (see xunit help parameters). I verified that appveyor was still picking up tests as they ran without this.
& ${TestRunnerRootPath}net452\xunit.console.exe $dll $ReporterOption | ||
} | ||
Push-Location $SourceRoot\$project | ||
& dotnet test --no-build --framework $framework --configuration $Configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was required to enable netcoreapp2.1 tests because the entry point has to be netcoreapp2.1 cognizant and xunit.console only releases netcoreapp2.0 DLLs.
This update brings the script more in line with the current recommendations from both dotnet and xunit. It handles correctly detecting the xunit runner based on test projects' PackageReference
s and correctly handles the net461 case.
@@ -14,7 +19,7 @@ | |||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), build.props))\build.props" /> | |||
|
|||
<ItemGroup> | |||
<PackageReference Include="CommandLineParser" Version="2.2.1" /> | |||
<PackageReference Include="CommandLineParser" Version="2.5.0" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was required to test the change in docker; the multitool breaks in docker using 2.2.1 due to commandlineparser/commandline#153
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since .NET Core 2.1, the
dotnet
CLI tools have supported a concept called Global Tools, which allows a NuGet package containing a console app to be easily installed/distributed in a manner which is consistent with other tools and compatible across multiple platforms/CI systems.This PR adds support for installing in this fashion to the Multitool. Usage (from any dev/CI environment with v2.1+ of the .NET Core SDK installed) would look like:
This involved adding a netcoreapp2.1 TargetFramework to the Multitool. I presumed that adding this as a built/supported/published target implied you'd want the test projects to build/run for that framework like they do for the other supported frameworks, so this also adds netcoreapp2.1 targets to all the test projects and updates appveyor configuration appropriately to run them. It also updates appveyor to use a 2.1 .NET Core SDK version.
Here is an example of using the multitool from the standard
dotnet/core/sdk docker
linux container using nupkgs produced with these changes: