File Content Replacer effect on artifacts

I'm a new, fresh TeamCity user, so all features are technically "new" to me. However, as it turns out, a feature was just released that I needed: File Content Replacer. Or at least I think so.
In my current setup I have a version.js file in my VCS:

window["MyPlugin"].version = "1.0.##VCS_REVISION##.##CI_BUILD_NUMBER##";

I use the File Content Replacer build feature to replace that last part with:

So far so good!

I have one relevant build step. It's an MSBuild step, but it does nothing except call a ps1, which does two relevant things:

1. Moves all js files to an "output" folder;
2. Zips all js files into a "zips" folder;

Those are also my two artifacts (an output folder, and a zip file).

However, the File Content Replacer reverts its changes, but this revert is also reflected in artifact nr 1, which are files that are not under version control (even though they are located as a subfolder of my project folder). The version.js file in the zip file is not reverted.

How do I set things up so that the artifact files are not affected by this revert? Or do I need something other than this Build Feature?

PS. If it's relevant, I'm using TeamCity 9.1.3 build 37176 running on Windows 2012 Server (VM) and the default database for evaluation purposes. I'm using TFS 2013 as my VCS.


Edit / addition: if I change artifact 1 to be "my/output/folder =>" then the zip file will also contain a reverted state instead of the output I want.

Comment actions Permalink

I saw on my new post that there's a checkbox to mark something as a question.

I tried editing this thread to also be an official question, but couldn't find how to do this. Perhaps a mod can step in and change the thread type?

Comment actions Permalink

Hi Jeroen,

Please find my answer on stackoveflow:

Comment actions Permalink

Thank you. I've checked the build log and now indeed notice that this is "By Design".

As such, I've marked your SO answer as the accepted one.

For this forum though, I submit that this design is flawed. The built-in "Artifacts" feature of TeamCity is not useful anymore if combined with the File Replacer feature. I'd suggest / expect that this feature would:

  • Do its replacement right after VCS checkout / update;
  • Revert replacements only after publishing artifacts;

I realize that this might be easier requested than done, since it's implemented as a "Build Feature", which I'm guessing can't operate after artifact publishing. But still...

Comment actions Permalink

Thank you for your feedback. Please feel free to create a feature request in our tracker: for ability to revert changes after artifacts publishing.

Comment actions Permalink

Allright. I've done as you proposed. See TW-43173 /


Please sign in to leave a comment.