-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
msbuild clean wrong files during compilation #11364
Comments
Adding binary log for combined solution compilation which will lead to situation where Project2 FileListAbsolute.txt contains files which are not part of the project itself. |
@maridematte Any update on this ? This issue affecting quite few developers in our company. |
@payn-git, I attempted to replicate the bug following the described steps but couldn’t reproduce it. Is it still occurring on your side? |
Yes its still happening and 100% reproducible. We are now on 17.13.19+0d9f5a35a for .NET Framework. Please see attached outputs from compilation. Performed actions:
I guess question is why is msbuild including files from referenced projects A inside *.csproj.FileListAbsolute.txt of project which has A configured as compile time dependency when generated monster solution is compiled. PS: exactly same is happening for each end every project. Mean if project have compile time dependency to A all files, all files from A are listed in *.csproj.FileListAbsolute.tx for such project. And when project is compiled individually all such files are deleted during compilation. PS: for some reason I cant attach output form compilation. Upload will fail with no specific reason..... I can provide binlogs, generated monster solution and content of obj folder content from compilation on both monster solution and sub-solution.... |
And I just saw this :). It seems that's on purpose, but its not explaining why. And how to avoid that as this behavior is causing problems. Not sure in which scenario this is actually desired behavior. https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-targets?view=vs-2022 GetCopyToOutputDirectoryItems |
Issue Description
We have below structure in repository. When we are compiling individual folder solutions separately everything works correctly. We have also combined solution which contains all projects from all folders. If we will compile that solution everything works correctly. However, if we will compile combined solution first (compile correctly), and then we will compile just project2 (some code changes), msbuild will delete files which are part of the project1 from output directory even if project1 was not compiled at all. It seems that project2 FileListAbsolute.txt in obj compilation folder contain list of files from Project1 (probably generated when combined solution was compiled ?). As files which are not part of compiled solution are deleted from target location application will not start anymore. We have to go back and recompile Folder1 solution again. This is affecting productivity a lot and if people are not aware about this, they even spend lot of time investigating why those files are disappearing.
Please see attached binary log from compilation. Im not able to attach projects\solutions for reproducibility as those are protected IP.
msbuild.DeletingWrongFiles.zip
MI.Biz.Plugin.Registration.csproj.FileListAbsolute.txt
Folder1
Folder2
CombinedSolution (Folder1\Folder2)
Steps to Reproduce
Compile combined solution first. Compile individual projects afterwards.
Expected Behavior
Files which are not related\owned by compiled project\solution should not be deleted from compilation output directory.
Actual Behavior
Files which are not part of compiled project\solution are deleted from compilation output directory.
Analysis
No response
Versions & Configurations
MSBuild version 17.12.12+1cce77968 for .NET Framework
17.12.12.57101
The text was updated successfully, but these errors were encountered: