Wednesday, July 20, 2011

Creating "Debug\blah.unsuccessfulbuild" because "AlwaysCreate" was specified.

Now this 'Creating "Debug\blah.unsuccessfulbuild" because "AlwaysCreate" was specified.' appearing in the Visual Studio 2010 output window is really annoying.

Most of those who had this annoyance have had some of their project files missing. You can look for missing file by opening each project file in Visual Studio. But in my case, I can actually open all project files in Visual Studio. So I had to inspect the Visual Studio log as described here. Unfortunately, my DebugView does not show useful stuff from Visual Studio even when running under Administrative privilege. I have to use file logging instead.

My devenv.exe.config looks like this:

<?xml version="1.0"?>
<configuration>  
  <configSections>
…   
  </configSections>

  <system.diagnostics>
    <switches>
       <add name="CPS" value="4" />
    </switches>
    <trace autoflush="false" indentsize="2">
       <listeners>
         <add name="myListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="e:\\TextWriterOutput.log" />
         <remove name="Default" />
       </listeners>
    </trace>
  </system.diagnostics>

Restart Visual Studio and e:\TextWriterOutput.log will have something. Run your project and check the log, you will see what's wrong. In my particular situation, I have these lines in the log:

  devenv.exe Information: 0 : Project 'D:\projects\bar\blah.vcxproj' is not up to date because 16 build inputs were missing.
  devenv.exe Information: 0 :  up to date is missing: 'D:\PROJECTS\FOO\SRC\STDAFX.H'
  devenv.exe Information: 0 :  up to date is missing: 'D:\PROJECTS\FOO\SRC\DEBUG.H'

"D:\Projects\Foo" was a directory that no longer exists, that's what's wrong. Why did that happen? I renamed the project folder from "D:\Projects\Foo" to "D:\Projects\Bar". Those files can still be opened in Visual Studio, but somehow the build engine is missing the track. Re-adding the files to the project solve the problem.