You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix "Clean" build target for xamarin-android repo #1129
There is no working "Clean" process. MSBuild is lame by design and does not appropriately resolve dependencies in reverse order so any project whose "Clean" target depends on dependencies's outcome will abort.
We should scrap MSBuild or (insert anything here; I can't think of any reasonable way to achieve this. Any other solution results in external tooling to automatically track dependencies).
What do we want out of a Clean target? What is the intention?
We could create a make clean rule which runs git clean -xdff. Would that be sufficient or adequate?
Alternatively, we could "fix" our Clean targets to not require use of generated files. For example, src/OpenTK-1.0/OpenTK.csproj could change the Xamarin.Android.CSharp.targets import to be conditional:
which could plausibly result in a "bizarre" error condition on build if the file doesn't already exist (which is already the case! the error message will just be different), but should allow Clean to work (more?) sanely.
Reflecting internal discussion: there are make clean and make distclean. git clean -xdf is basically distclean, and by asking everyone everytime means you are asking to download any dependencies within the repo every time (which is reportedly not particularly for the mono runtime case anymore).
Working clean target for every part is important for developers who work on individual part. MSBuild tasks hackers shouldn't be required to clean up Mono.Android.dll at any case.
We shouldn't keep awkward code quality where Makefile exists and make clean does not work.
(Aside: Mono quickly starts looking bananas: make -C mono/mini removes some files in mono/metadata, but it doesn't do the same things as make -C mono/metadata.)
I fear that the answer to "what should the Clean target do?" will vary on a project-by-project basis. For some projects we'll want it to also clean @(ProjectReference)s. In others, we won't.
We'll need to figure out a set of guidelines, and coerce projects to follow them as needed/desired.
Activity
atsushieno commentedon Dec 22, 2017
How to resolve stupid MSBuild solution structure with broken Clean targets
Current "(simple and?) stupid" MSBuild style
Target "Build"
target
CleanWTF, TELL ME HOW TO DO THIS!
msbuild /t:Clean all.slndoesn't work fine, as depending.proj could be using artifacts from dependency.proj etc.Makefile style
Target "Build"
(Remove
<Reference>s in the .proj.)target
CleanProcessed in order. It is clean and easy enough to understand.
Proposed "clever" MSBuild style
<Reference><ReferenceOutputAssembly>True</></><BuildDependsOn>and list things in well-structured order, if necessary.Code:
Bring in cleanliness to this ugly XML land.
Conclusion
atsushieno commentedon Jan 5, 2018
So far, solution content analyzer https://github.com/proxy/gist.github.com/atsushieno/9731101673efa97950e9b9eb368b2cbf
Sanitize Xamarin.Android.sln: fix several inconsistency bits.
atsushieno commentedon Jan 5, 2018
The updated solution content analyzer (rev. 2 on the gist) gives more structured solution information. Namely, the output became as simple as https://github.com/proxy/gist.github.com/atsushieno/671667cbe09140862f1081f0e3c196f4 . This is against the fixed solution from PR #1159.
jonpryor commentedon Jan 9, 2018
What do we want out of a
Cleantarget? What is the intention?We could create a
make cleanrule which runsgit clean -xdff. Would that be sufficient or adequate?Alternatively, we could "fix" our
Cleantargets to not require use of generated files. For example,src/OpenTK-1.0/OpenTK.csprojcould change theXamarin.Android.CSharp.targetsimport to be conditional:which could plausibly result in a "bizarre" error condition on build if the file doesn't already exist (which is already the case! the error message will just be different), but should allow
Cleanto work (more?) sanely.Sanitize Xamarin.Android.sln: fix several inconsistency bits. (#1159)
atsushieno commentedon Jan 10, 2018
Reflecting internal discussion: there are
make cleanandmake distclean.git clean -xdfis basically distclean, and by asking everyone everytime means you are asking to download any dependencies within the repo every time (which is reportedly not particularly for the mono runtime case anymore).Working clean target for every part is important for developers who work on individual part. MSBuild tasks hackers shouldn't be required to clean up Mono.Android.dll at any case.
We shouldn't keep awkward code quality where Makefile exists and
make cleandoes not work.jonpryor commentedon Jan 10, 2018
The question is, what are the desired semantics for a
Cleantarget?Specifically, should running the
Cleantarget in a given directory also clean the dependencies?For example, consider mono:
Is it "expected" that running
make cleanwithinmono/minialso cleans upmono/metadata?Which is in part the problem/question: expectations vary, not only between developers and projects, but between directories as well:
(Aside: Mono quickly starts looking bananas:
make -C mono/miniremoves some files inmono/metadata, but it doesn't do the same things asmake -C mono/metadata.)I fear that the answer to "what should the
Cleantarget do?" will vary on a project-by-project basis. For some projects we'll want it to also clean@(ProjectReference)s. In others, we won't.We'll need to figure out a set of guidelines, and coerce projects to follow them as needed/desired.
jonathanpeppers commentedon Apr 16, 2026
The conversation here is very old, closing for now.
Related (great explanation of MSBuild Clean target):