Build process change WRT references #8495
Unanswered
TahirAhmadov
asked this question in
Ideas
Replies: 1 comment 5 replies
-
This is called reference assemblies and has been supported in C# and VB for many years. It's on by default for .NET 5.0+ and can be enabled for any project, as of 17.5 (prior to this it was supported only in projects that used the .NET SDK but caused problems in Visual Studio if enabled for non-SDK projects). We're planning to turn it on by default for all projects, tracked by #8133. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Can we change it to check for the referenced DLL's public surface area, and only treat it as a reason to build this project if the referenced DLL's public surface area changed, and not whenever the referenced DLL was touched in any way (such as due to a change in a private member or method body code)?
I envision that each DLL gets a "public surface area image" (PSAI), which is a loss-less compressed signature, basically a byte array. Then, for each project which references DLLs, we add a "cache" of the PSAI for each reference, and store it in something like the
obj
folder. After we detect a write time change of the referenced DLL, we compare the cached PSAI with the one from the newly modified referenced DLL, and if the PSAI has actually changed, consider this reference to be a trigger for rebuilding our current project.This would drastically reduce the build times for large solutions, because if there is a dependency chain of A->B->C->D, and D gets a non-public change, then currently, we rebuild A, B, C, and D; whereas with my proposal, we would only build D, run the public surface area comparison on C (which should be a simple byte array comparison and therefore very quick), and (granted D's public surface area didn't change), skip building C, and do absolutely nothing for A and B (since C wasn't rebuilt, its write time hasn't changed; ditto for B).
Also, deployments would be faster, because the build/deployment tools can be optimized and only copy the few DLLs that actually need to be copied (or even, get immediate improvements if they already compare write times between build and deployment locations).
Downside: the build time for each individual project will go up a bit, as the PSAI will need to be generated.
And finally, this behavior can be made optional, so those users who prefer the old behavior (if they feel it's more reliable) can continue using it.
Beta Was this translation helpful? Give feedback.
All reactions