Skip to content
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

FastUpToDate broken with GeneratePackageOnBuild+SuggestedBindingRedirects #5406

Open
xen2 opened this issue Jun 5, 2020 · 2 comments
Open

Comments

@xen2
Copy link
Contributor

xen2 commented Jun 5, 2020

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:

image

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

@rainersigwald
Copy link
Member

GenerateBindingRedirects is run a second time during Pack step:

This seems like the heart of the immediate problem. Not sure if the fix is here or in dotnet/sdk; we'll investigate.

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.

This also seems completely bogus. Let's see if we can figure out why that was (to make sure it wasn't a good idea for some reason) and then fix it.

@rainersigwald rainersigwald added this to the pre milestone Jun 10, 2020
@AR-May AR-May added the triaged label Feb 21, 2024
@KirillOsenkov
Copy link
Member

Potentially related: #9337

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants