How do i fix the error MSB3491    Could not write lines to file “D:\code\..\tools\optimized\obj811\amd64\Tools\Tools.tlog\Tools.lastbuildstate”. Could not find a part of the path ‘D:\some-path\tools\optimized\obj811\amd64\Tools\Tools.tlog\Tools.lastbuildstate’ ?

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets    312

Indeed Tools.tlog does not exist.


It looks it works after moving the import tags at the end of the project file.

Can anyone explain the trick? I mention i have migrated the project from VS2012 to VS2015 ……

That is,

  <Target Name="PrepareForBuild">
     <Message Text="-------------------------------------------------------------------------------">
     <Message Text="Make sure directory $(TOOLSOBJDIR)$(ProjectName)\ exist">
     <Message Text="-------------------------------------------------------------------------------">
     <MakeDir Condition="!Exists('$(TOOLSOBJDIR)$(ProjectName)')" Directories="$(TOOLSOBJDIR)$(ProjectName)\" />
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">

Also, related
We’ve discovered that the cl.*.tlog files often have stale/bad information for our C++ project.

Reading this post: led me to add this XML at the top of all my vcxproj files:

<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="">




Yes, you can add


to turn off the TrackFileAccess.

As a result, no output file/intermediate file information will be write down to

which makes VCBuild doesn’t know if the output files exists.

This entry was posted in develop and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s