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

[Broken Build]: Native DLL output deleted on IncrementalClean #10931

Open
znakeeye opened this issue Nov 4, 2024 · 4 comments
Open

[Broken Build]: Native DLL output deleted on IncrementalClean #10931

znakeeye opened this issue Nov 4, 2024 · 4 comments
Assignees
Labels

Comments

@znakeeye
Copy link

znakeeye commented Nov 4, 2024

Issue Description

I have a WPF exe project referencing a Library project which in turn references a Native DLL project. See attached sample project.

When rebuilding the solution, the output folder of the exe project contains all binaries:

MyLib.dll
NativeLib.dll
WpfApp2.dll
WpfApp2.exe

Then, perform any code change in the WpfApp2 project and Build it (F7 on my setup). The NativeLib.dll gets deleted. Using verbose logging, I can see that it incorrectly gets picked up in _CleanOrphanFileWritesInOutput processed by the IncrementalClean target.

Steps to Reproduce

See attached sample project.

SimpleApp.zip

Expected Behavior

Native DLL output should not be deleted when building solution.

Actual Behavior

Native DLL output is deleted when building solution.

In real-world solutions, this causes runtime errors. We have spent many days trying to debug issues that weren't real issues; the build is in fact broken.

Ask us questions

No response

@JaynieBai JaynieBai self-assigned this Nov 6, 2024
@JaynieBai
Copy link
Member

Repro it and binlog msbuild.binlog.txt

@yuehuang010
Copy link
Contributor

Generally, the task/target that copies the NativeLib.dll to the output directory should also append to the "FileWrite" ItemGroup so that the Incremental Clean step won't delete it.

I wonder if this is the bug where building from the IDE and command line has different behavior.

@KalleOlaviNiemitalo
Copy link

It's "FileWrites", plural.

Which is not consistent with item types like "Compile" having been named with the singular form, but too late to change now.

@jzabroski
Copy link

jzabroski commented Nov 25, 2024

Note, this is not necessarily the same issue as the one linked above just now.

In this issue, the problem is a Native DLL project.

In my issue, the problem is with nuget package Microsoft.Data.SqlClient.SNI copying Native DLLs from its buildTransitive folder to the build output directory, but subsequently gets deleted by IncrementalClean.

If a member of the nuget team can explain how does nuget normally handle this, I can try to pitch in and fix this. I tried to find the nuget targets that control restore but no success yet. I plan to search everywhere FileWrites is mentioned in my sdk path.

It does seem like there should be a simple item collection that automatically gets added to FileWrites by the Build step, or similar. As a simple thought, the item collection could be called <Runtimes> as we have a <Content> folder already that maps to the nupkg top-level folder \content\. Perhaps this already exists in some other form and I'm simply unaware.

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

6 participants