GenerateBindingRedirects is always executed due to SuggestedBindingRedirects not being a file.
This doesn't work well with GeneratePackageOnBuild since this target is called again during Pack and changing .config file timestamp.
Steps to reproduce
Project file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Build.Locator" Version="1.2.6" />
</ItemGroup>
</Project>
Run build in VS multiple times.
UpToDate check fails with:
1>FastUpToDate: Checking copied output (UpToDateCheckBuilt with Original property) file 'C:\Users\xen\source\repos\ConsoleAppFUTD\ConsoleAppFUTD\obj\Debug\netcoreapp3.1\ConsoleAppFUTD.dll.config': (ConsoleAppFUTD)
1>FastUpToDate: Source 2020-06-05 11:49:36: 'C:\Users\xen\source\repos\ConsoleAppFUTD\ConsoleAppFUTD\obj\Debug\netcoreapp3.1\ConsoleAppFUTD.dll.config'. (ConsoleAppFUTD)
1>FastUpToDate: Destination 2020-06-05 11:49:35: 'C:\Users\xen\source\repos\ConsoleAppFUTD\ConsoleAppFUTD\bin\Debug\netcoreapp3.1\ConsoleAppFUTD.dll.config'. (ConsoleAppFUTD)
Investigation
GenerateBindingRedirects is run a second time during Pack step:

The .config file is being written a second time in the obj folder after having it's been copied from obj the bin folder during the previous Build step. This results in wrong timestamps for next build/fast-up-to-date check.
It can't even be skipped because the GenerateBindingRedirects target contains SuggestedBindingRedirects in its list of Target.Inputs, and those items are assemblynames instead of files. As a result, the target Inputs/Outputs check will always fail.
https://github.com/microsoft/msbuild/blob/dc485bce3427e9d2b020ce61c2400e7b5a76062c/src/Tasks/Microsoft.Common.CurrentVersion.targets#L2194
Expected behavior
FastUpToDate check work and build is skipped
Actual behavior
FastUpToDate check doesn't work
Environment data
msbuild /version output:
OS info: Windows 10
If applicable, version of the tool that invokes MSBuild (Visual Studio, dotnet CLI, etc):
Visual Studio 16.6.0
GenerateBindingRedirectsis always executed due toSuggestedBindingRedirectsnot being a file.This doesn't work well with
GeneratePackageOnBuildsince this target is called again duringPackand changing.configfile timestamp.Steps to reproduce
Project file
Run build in VS multiple times.
UpToDate check fails with:
Investigation
GenerateBindingRedirectsis run a second time during Pack step:The
.configfile is being written a second time in theobjfolder after having it's been copied fromobjthebinfolder during the previousBuildstep. This results in wrong timestamps for next build/fast-up-to-date check.It can't even be skipped because the
GenerateBindingRedirectstarget containsSuggestedBindingRedirectsin its list ofTarget.Inputs, and those items are assemblynames instead of files. As a result, the target Inputs/Outputs check will always fail.https://github.com/microsoft/msbuild/blob/dc485bce3427e9d2b020ce61c2400e7b5a76062c/src/Tasks/Microsoft.Common.CurrentVersion.targets#L2194
Expected behavior
FastUpToDate check work and build is skipped
Actual behavior
FastUpToDate check doesn't work
Environment data
msbuild /versionoutput:OS info: Windows 10
If applicable, version of the tool that invokes MSBuild (Visual Studio, dotnet CLI, etc):
Visual Studio 16.6.0