Build step triggered by TeamCity always builds - even when there are no changes Build step triggered by TeamCity always builds - even when there are no changes powershell powershell

Build step triggered by TeamCity always builds - even when there are no changes


So, as I mentioned in "Update #2" above, the problem seems to be caused by 2 things:- TeamCity sets the TEMP and TMP environment vars to its own temp directory- TeamCity "cleans" this temp directory prior to every build- Part of the msbuild process runs a GenerateTargetFrameworkMonikerAttribute target that updates a specific file in the directory specified by the TEMP environment variable - causing the compiler to thing it needs to recompile the whole project

Once I figured this out, I found an applicable answer in this unrelated question:In Visual Studio 2010 why is the .NETFramework,Version=v4.0.AssemblyAttributes.cpp file created, and can I disable this?

So I added:

<Target Name="GenerateTargetFrameworkMonikerAttribute" />

to both of the projects in my solution that compile to DLLs and it worked.


As a variation of obliojoe's answer, you can backup and restore these files to/from TEMP folder, if you do not want or cannot change the individual project files:

  1. First attempt to restore the files from a backup:

    copy temp\*.* %%temp%% /yecho AssemblyAttributes restore attempted
  2. Then perform your build step(s) using TeamCity build runner

  3. Backup the files:

    mkdir temp 2> nilcopy %%temp%%\*AssemblyAttributes.cs temp /yecho AssemblyAttributes files saved

Both batch files need to run from the same directory.

Do note the final ECHO in these batch files, it is there to guarantee successful exit (error code 0).