-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Particularly when setting:
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>We expect that when A references B and B changes in a way that does not impact its public API, then A does not need to be recompiled. But when A has a package reference to Nullable, it recompiles anyway for no good reason, making incremental builds slower.
Input file "C:\git\lib.template\obj\Library.Tests\Debug\netcoreapp3.1\NuGet\8ED094343F5007F7EC35D088A29F28BB2E4E7756\Nullable\1.3.0\Nullable/MemberNotNullAttribute.cs" is newer than output file "C:\git\lib.template\obj\Library.Tests\Debug\netcoreapp3.1\Library.Tests.xml".
Can you fix this by ensuring the timestamp is not updated on this file unnecessarily?
You can test this for yourself, and verify the effectiveness of your fix, using my template repo as follows:
git clone https://github.com/AArnott/Library.Template.git
cd Library.Template
.\init[.ps1]
dotnet build
Then make a change to Calculator.cs that does not impact the public API. Perhaps this:
- public static int Add(int a, int b) => a + b;
+ public static int Add(int a, int b) => a + b + 1;Then run:
dotnet build -bl
Open up the msbuild.binlog (in the https://msbuildlog.com viewer) and search for $task csc to see how many times the compiler actually ran. We want to see it just once. When Nullable is not referenced, this happens. But when it is referenced, we see 4.
