2

The AssemblyInfoPatcher build feature isn't working. Some files are patched and some are not.

Assembly file version was specified, but couldn't be patched in file D:\TeamCity\Agent\buildAgent\work\6afd998e316c631f\La\Di\Da\Properties\AssemblyInfo.cs. Is necessary attribute missing?

I thought it was because it was 1.0.* since one of the failed files had this format, and one of the successful ones had the default 1.0.0.0 format, so I changed the attribute to 1.0.0.0 across the entire solution and now none of them work.

I get either the error above or:

Assembly version attributes were not found in ...

The attribute is defined and at least two other people on the team have confirmed that they can also see it using their production eyes.

Happy to stump up the cash so I can smash my work keyboard.

Luke Puplett
  • 42,091
  • 47
  • 181
  • 266

1 Answers1

0

Well, I managed to get it working but not.

I had a Configuration Parameter called AssemblyVersionStringWithCounter that I set from a PowerShell script. I was using this in the patcher feature.

I changed it to be composed of other parameters like

%MajorVersionNumber%.%MinorVersionNumber%.%BuildWeek%.%build.counter%

And now it mods the files but the params are not set, the version is incorrect. Seems the AssemblyInfoPatcher cannot use values set during the build steps.

Seems I've wasted about £800 of my client's money when I should have just PowerShelled it from the start. Code is King.

Luke Puplett
  • 42,091
  • 47
  • 181
  • 266
  • 1
    I suspected that [the solution you previously came up with](http://stackoverflow.com/a/33919854/1540600) might not work. I'll explain it in the other question. – sferencik Nov 26 '15 at 12:47
  • One advantage of the AssemblyInfoPatcher over a scripted solution (other than the convenience) is that it ensures to roll back the change at the end of your build. That way, your checked out files match what's in your VCS. – sferencik Nov 26 '15 at 12:55
  • Thanks. Regarding your final point, I noticed that the patcher reverts everything and I was considering ensuring the working/checkout folder is cleared before each build, though that puts a dependency on docs/human knowledge. Maybe I could rename the original files and put it all back again. Else I'd have to script a dependency on Git. If the files are left, it shouldn't matter (until it bites me). – Luke Puplett Nov 26 '15 at 13:59
  • @LukePuplett: since *AssemblyInfo Patcher* is a *build feature*, not a *build step*, it modifies source files *before* any build step is executed. That said, it will always use the default values (those effective at the beginning of the build) of your configuration parameters or environment variables, no matter how you modify those in the subsequent build steps. – Bass Nov 27 '15 at 10:57