msbuild: error MSB3374: The last access/last write time on file "MyProject.tlog\MyProject.lastbuildstate" cannot be set.

Francois 1 Reputation point
2020-12-06T19:53:11.317+00:00

Hi,
On my continuous build server (using Teamcity), I'm trying to migrate from a devenv command line, to a msbuild command line.
But when I enable to multicpu switches I have this error :

error MSB3374: The last access/last write time on file "MyProject.tlog\MyProject.lastbuildstate" cannot be set. The process cannot access the file 'MyProject.tlog\MyProject.lastbuildstate'

Not that I add this 2 switches:

/maxcpucount /nodeReuse:False

Without /maxcpucount I do not have error on lastbuildstate. But it takes twice more time!!
Note that my project are in C++. Around 100 projects with multiples dependencies (define by reference project properties)

Is anyone could help me to solve that?

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
35,887 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Dylan Zhu-MSFT 6,406 Reputation points
    2020-12-07T07:14:23.497+00:00

    Hi Francois,

    Please try to modify the "nodeReuse" to "True" or remove this switch, and then re-build your project. If it doesn't work, maybe you could try to re-install your visual studio.

    Best Regards,
    Dylan


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our **documentation to enable e-mail notifications if you want to receive the related email notification for this thread.**

    0 comments No comments

  2. Francois 1 Reputation point
    2020-12-07T14:46:57.36+00:00

    Hi Dylan,
    I first try without nodeReuse, just with /maxcpucount, and have the same problem.
    I relaunch with /nodeReuse=True, I also have the exact same error.
    I launch on multiple PC, and sometimes, on some old PC with not lot of cores/threads, it could compile without error. But in 95% of the cas, I have this error.

    About the installation, I have a standard installation of Visual Studio 16.7.7 on multiple PCs, and same error on all that PC. MSBuild version 16.7.0.37604.

    I also make a test on a PC with the latest version, VS 16.8.2, msbuild version 16.8.2.56705, and I have the same error too.

    Note that something is strange for me: that the project with the .lastbuildstate where the error happens, if one of the first project build, and almost all projects are depending on that project. I do not really understand why.

    I also have another error. I have a PostbuildEvent in a low level project (most of my project are depend on that project). This post event, is used to sign the dll. I regularly have error on that post build event. It seems that the sign tool cannot open the dll sign with write access.
    And that post build event is present multiples times in the log ! (in /nodeReuse:False or /nodeReuse:True)