Search code examples
buildconstantstaskpipelineassemblyinfo

Update AssemblyInfo const variable


I have a single file where I specify my version:

assemblyfile

I try to update it with the 'Update AssemblyInfo' task on build pipeline:

build task

when executing the task do logs the update:

Searching for files...


============================================================

D:\BuildAgent01\_work\21\s\AutomationGeneral\Properties\SharedAssemblyInfo.cs

Updating attributes
-------------------
Skipped 'AssemblyProduct' (no value defined)
Updating 'AssemblyVersion'...
Updating 'AssemblyFileVersion'...
Updating 'AssemblyInformationalVersion'...
Saving changes...

But the content of the file is not updated: it stills remains:

[assembly: AssemblyFileVersion(SolutionItem.Version)]

Do I need to remove the const string and put the string content inside of the parameter of the method?

[assembly: AssemblyFileVersion("1.1.1.1")]

so the replacement will be really done?

is not the Task messing here? or is it me?


Solution

  • yes it seems that once there is no more variable inside the parenthesis it works: it manages to update only if there is string content in the parenthesis.

    and when it succeeds it prints the version number too:

    Configuration: 
    
    Version: 1.20.1120.05
    
    File version: 1.20.1120.05
    
    InformationalVersion: 1.20.1120.05
    
    Custom attributes: