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

[Bug]: Deleted embedded resources dont cause rebuild #10644

Open
innominateAtWork opened this issue Sep 10, 2024 · 7 comments · May be fixed by #10928
Open

[Bug]: Deleted embedded resources dont cause rebuild #10644

innominateAtWork opened this issue Sep 10, 2024 · 7 comments · May be fixed by #10928

Comments

@innominateAtWork
Copy link

innominateAtWork commented Sep 10, 2024

Issue Description

dotnet build does not detect deleted EmbeddedResources.

Steps to Reproduce

  1. Download example project from https://github.com/innominateAtWork/NoRebuildWhenDeleteEmbeddedResource
  2. dotnet run it outputs all files included as EmbeddedResources in MyApp.csproj and their content
  3. Change the text in File1.txt
  4. dotnet run the project rebuilds and includes the updated text
  5. Delete File1.txt
  6. dotnet run the project does NOT rebuild the run looks identical to the prior run

Expected Behavior

MyApp rebuilds because an EmbeddedResources has been deleted.

Actual Behavior

MyApp does NOT rebuild.

Analysis

No response

Versions & Configurations

MSBuild version 17.11.3+0c8610977 for .NET
17.11.3.35201

@innominateAtWork
Copy link
Author

Similarly adding a File3.txt also does not cause rebuild

@innominateAtWork innominateAtWork changed the title [Bug]: New embedded resources dont cause rebuild [Bug]: Deleted embedded resources dont cause rebuild Sep 10, 2024
@AR-May
Copy link
Member

AR-May commented Sep 17, 2024

Team triage: @JaynieBai! Could you please try to repro and collect binlogs for this issue?

@JaynieBai
Copy link
Member

@AR-May I repro this issue locally.
Here is the log when delete the File1.txt. there is no File1.txt shown in the binlog.
CentralNode_dotnet_PID=24032_x64_BuildManager_Default.binlog.txt

But when delete the File1.txt and save the other files in the project folder. The date modified is updated. It will rebuild the project and output different result.

@JaynieBai
Copy link
Member

JaynieBai commented Sep 18, 2024

Similarly adding a File3.txt also does not cause rebuild

Can't repro this one

@AR-May
Copy link
Member

AR-May commented Sep 18, 2024

Thank you @JaynieBai!
@rainersigwald the incremental build scenario is broken when one tries to delete from EmbeddedResources, but no other change is present. It seems like the CoreCompile target is skipped due to all outputs being newer than all inputs, which is true, but not correct. The only change since the previous build is deleted File1.txt and it is absent from inputs as well, so this change does not trigger the re-compilation of assembly.

@innominateAtWork
Copy link
Author

It looks like copying a file does not trigger a rebuild, but creating a new file does.

> dotnet run
MyApp.File1.txt = A
MyApp.File2.txt = B
> cp File2.txt File3.txt
> dotnet run
MyApp.File1.txt = A
MyApp.File2.txt = B
> echo C > File4.txt
> dotnet run
MyApp.File1.txt = A
MyApp.File2.txt = B
MyApp.File3.txt = B
MyApp.File4.txt = C

@rainersigwald
Copy link
Member

Ah that makes sense and we should fix it by bringing back #6780.

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

Successfully merging a pull request may close this issue.

4 participants