feat: Add custom MsBuild targets to remove unnecessary files from bin directory #2737
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR intended to resolve #2736
What's changed in this PR
1. Add custom MSBuild targets file to nupkg.
This custom target is packed as
buildTransitive/BenchmarkDotNet.targets
file.And it'sused by .NET SDK-Style projects. (It's ignored when referenced from .NET Framework non-SDK style project)
2. Details of custom MSBuild target process.
It try to set
BenchmarkDotNetTargetPlatform
property.If target
runtime
is explicitly specified (e.g.--runtime
) just use specified runtime.Otherwise. try to use current build environment platform.
Then
FilterBenchmarkDotNetPackageAssets
custom target try to remove following files.runtime/*
files that are copied fromGee.External.Capstone
packageMicrosoft.CodeAnalysis.*
packageBreaking changes
This PR contains following breaking changes.
runtimes\*
files that not matched to current build environment are not copied to bin by default.When it need to use old behaviors. It need to set following MSBuild property on benchmark project.
What's tested on my environment.
I've confirmed PR behaviors with following steps (On Windows/Ubuntu on WSL)
packages
directory as package source.3.1.
runtimes/*
directory contains only current build environment's runtime only3.2. Satellite assembly directory is not copied to bin directory.
--keepFiles
options. and confirm temporary project outputs.Additionally, I've confirmed following behaviors.
dotnet publish -r {runtimeIdentifier}
command works as expected. (Satellite assembly is not copied)