FastUpToDate broken with GeneratePackageOnBuild+SuggestedBindingRedirects
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 141
Description
`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
```xml
Exe
netcoreapp3.1
true
```
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
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.