Project-system: .NET Core 2.0 EXE is rebuilt every time in VS until project references are changed

Created on 20 Dec 2017  路  6Comments  路  Source: dotnet/project-system

_From @loop-evgeny on December 20, 2017 13:23_

Steps to reproduce

CoreBuildTest.zip

Open the solution in VS 2017. Make any change to Program.cs (e.g. add a space) and build the solution. Build the solution a second time.

Expected behavior

The second time all projects are considered up to date and not rebuilt. Build Output window shows

========== Build: 0 succeeded, 0 failed, 2 up-to-date, 0 skipped ==========

Actual behavior

ConsoleApp1 is rebuilt every time:

========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========

Environment data

msbuild /version output:

Microsoft (R) Build Engine version 15.5.180.51428 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

15.5.180.51428

OS info: Visual Studio 15.5.2 on Windows 7 x64 SP1

Note

If I either add or remove a project reference in ConsoleApp1 and build then the project is considered up-to-date from then on (further builds do not rebuild) until I modify a source file again.

_Copied from original issue: Microsoft/msbuild#2818_

Bug Feature-Up-to-date

Most helpful comment

Tools -> Options -> Projects and Solutions -> .NET Core -> Up to Date Checks to turn on logging.

All 6 comments

Looking at the logging of the subsequent build, it is incremental (the compiler doesn't run, for instance), indicating that this is a problem with the project system's fast up-to-date check. Moving to that repo.

I think the problem is the output runtimeconfig.json, which isn't updated on incremental builds (for, presumably, good reasons).

FastUpToDate: Latest write timestamp on input is 12/20/2017 4:39:43 PM on 'S:\\work\\CoreBuildTest\\ConsoleApp1\\Program.cs'. (ConsoleApp1)
FastUpToDate: Earliest write timestamp on output is 12/20/2017 1:56:04 PM on 'S:\\work\\CoreBuildTest\\ConsoleApp1\\bin\\Debug\\netcoreapp2.0\\ConsoleApp1.runtimeconfig.json'. (ConsoleApp1)

For my edification, project-system people, how _should_ I have gotten access to that logging? It didn't seem to be emitted anywhere, so I eventually gave up and rebuilt the project system and ran it in a debugger emitting those messages through a breakpoint.

The legacy C# project system would emit a message like

1>Project 'ConsoleApp2' is not up to date. Input file 's:\work\consoleapp2\consoleapp2\program.cs' is modified after output file ''.

(I don't remember the output being blank, but that's what I just got trying it with 27217.0.d15.6.)

That would be nice (for the MSBuild team, if no one else, to route FUTD problems correctly 馃槆).

Tools -> Options -> Projects and Solutions -> .NET Core -> Up to Date Checks to turn on logging.

Thanks for the logging info, I was looking for that, too! With Info level it shows:

2>FastUpToDate: Latest write timestamp on input is 20/12/2017 2:16:24 PM on 'C:\W ork\Play\CoreBuildTest\ConsoleApp1\Program.cs'. (ConsoleApp1)
2>FastUpToDate: Earliest write timestamp on output is 20/12/2017 2:16:17 PM on 'C:\W ork\Play\CoreBuildTest\ConsoleApp1\bin\Debug\netcoreapp2.0\ConsoleApp1.runtimeconfig.json'. (ConsoleApp1)
2>FastUpToDate: No input markers exist, skipping marker check. (ConsoleApp1)
2>FastUpToDate: Write timestamp on output marker is 21/12/2017 9:09:17 AM on 'C:\W ork\Play\CoreBuildTest\ConsoleApp1\obj\Debug\netcoreapp2.0\ConsoleApp1.csproj.CopyComplete'. (ConsoleApp1)
2>FastUpToDate: Project is not up to date. (ConsoleApp1)

For some reason "Earliest write timestamp on output" is still yesterday, even though I just built the solution now.

The runtimeconfig.json bug is covered by #3018.

Was this page helpful?
0 / 5 - 0 ratings