-
Notifications
You must be signed in to change notification settings - Fork 389
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
Inconsistent copying of duplicate output folder items under build acceleration #9001
Comments
@drewnoakes can you look into this? |
This is an interesting one, thanks for the report. So, this happens when multiple projects that contribute a file with the same name to the output directory. We need to see what MSBuild does here and replicate that. Given... graph LR;
App --> Lib1;
App --> Lib2;
...there are two scenarios of interest.
Both of these should be investigated. |
A quick investigation using builds without acceleration:
This will need some further investigation before we can apply a fix. |
This is still an issue, please fix. |
Just spent two days trying to figure out why my appsettings.json wasn't copying over on a new machine when it works fine on an older one. I wasn't seeing the same as OP though. In my instance doing "Build/Rebuild" always used the correct file (App from @drewnoakes reply above) however debugging always used the incorrect one (Lib1), unless I deleted the bin/Debug folder. In that instance the very first time debugging would use the App appsettings.json, and every subsequent one would use Lib1's appsettings.json. So, that's a long winded way of saying, it's happening to me too, and please fix it. |
We have just started to experience this issue after VS2022 17.9 upgrade. We're on .net8.0 and disabling accelerated builds works as a workaround
|
I have to wonder why this was not considered a blocking issue for #9106. |
Just had the pleasure of debugging some unit tests for hours to find this as the cause of my failed tests. Please fix it. |
Thanks everyone for your patience here. A fix is in review: #9454 Teaching Build Acceleration to understand the exact ordering the MSBuild would use is complex and error prone. Instead, I've opted to have BA disable itself when it detects that multiple copy items want to write to the same path in the project's output. That way, in the rare case that this situation exists, we will fall back to calling MSBuild. With this, the FUTDC log will show a message like:
|
Reposting from developer community issue as this is probably a better place for the discussion... In my case I have projects A, B and C - all have an |
@simonfox I agree and did consider that. My concern is for cases like |
Visual Studio Version
17.5.5
Summary
With Build Acceleration enabled, Visual Studio is copying "Copy to output directory" same-named files from other projects, into the project that's running via fast build. It will alternate between copying the incorrect file (from another project) to the output directory, and the correct file (from the project that's running).
Steps to Reproduce
ProjectA
andProjectA.Tests
.ProjectA.Tests
referencesProjectA
.appsettings.json
with different values.appsettings.json
haveCopy to Output Directory
asCopy If Newer
orCopy Always
ProjectA.Tests
via fast buildappsettings.json
from ProjectA (bad), and ProjectA.Tests (good).See the vs-futdc-bug-demo repo to pull and immediately observe the issue, or for in-depth reproduction steps.
Expected Behavior
Actual Behavior
Build Acceleration copies the wrong file(s) over - alternating between the wrong and correct file every other Fast Build.
User Impact
In our case, erroneous test fails every other time as they depend on an appsettings.json file that's different than the project under test. We have to run our tests twice (once with bad config and they fail immediately, and a second time with the good config and an actual test run).
For work arounds we can either:
It seems like there could be broader impact though, if any same-name file from any referenced project could be copied over to the output bin. Maybe only if they trigger a fast-up-to-date-check like if the file has been read.
The text was updated successfully, but these errors were encountered: