Skip to content

[ISSUE]: Unexpected behaviour migrating to azd tasks v3 #1546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 tasks done
finluke opened this issue Mar 28, 2025 · 0 comments
Open
2 tasks done

[ISSUE]: Unexpected behaviour migrating to azd tasks v3 #1546

finluke opened this issue Mar 28, 2025 · 0 comments

Comments

@finluke
Copy link

finluke commented Mar 28, 2025

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

GitVersion package

AzureDevops task

What are you seeing?

I'm migrating from version 2 to version 3 of the azdo GitVersion tasks.

However, I'm seeing some behaviours I can't explain.

We have a pretty standard multi-project c# solution with a file called SharedAssemblyInfo.cs at the root. We configure GetVersion to update that file using our own config file.

I've done 3 tests as documented below where execute@2 produces the expected result, but neither execute@3 and command@3 do. I've included the command lines where are generated and they look correct and similar.

To summarise the below:

  1. execute@2 correctly updates our SharedAssemblyInfo.cs
  2. execute@3 updates every assembly info apart from our SharedAssemblyInfo.cs
  3. command@3 updates nothing

I'm at a bit of a loss to explain the differences.

execute@2

This is what we're migrating from and it works as expected:

- task: gitversion/execute@2
  displayName: GitVersion@2 - Run
  inputs:
    targetPath: '$(Build.Repository.LocalPath)'
    useConfigFile: true
    configFilePath: '$(Build.SourcesDirectory)/azdtasks/PipelineTemplates/GitVersion.yml'
    updateAssemblyInfo: true
    updateAssemblyInfoFilename: '$(Build.Repository.LocalPath)/SharedAssemblyInfo.cs'
    additionalArguments: '/ensureassemblyinfo /diag'

Here is the generated command from the build logs:

C:\hostedtoolcache\windows\GitVersion.Tool\5.12.0\dotnet-gitversion.exe D:/a/1/s/My.Project /output json /output buildserver /config D:\a\1\s\azdtasks\PipelineTemplates\GitVersion.yml /updateassemblyinfo D:\a\1\s\My.Project/SharedAssemblyInfo.cs /ensureassemblyinfo /diag
...
INFO [03/28/25 9:10:02:64] Updating assembly info files
INFO [03/28/25 9:10:02:64] Found 1 files
INFO [03/28/25 9:10:02:67] Done writing

This run is perfect and it has updated my SharedAssemblyInfo.cs as expected.

execute@3

This was my first attempt at migrating away from version 3. I see that additionalArguments are no longer supported but that doesn't matter too much.

- task: gitversion/execute@3
  displayName: GitVersion@3 - Run
  inputs:
    targetPath: '$(Build.Repository.LocalPath)'
    useConfigFile: true
    configFilePath: '$(Build.SourcesDirectory)/azdtasks/PipelineTemplates/GitVersion.yml'
    updateAssemblyInfo: true
    updateAssemblyInfoFilename: '$(Build.Repository.LocalPath)/SharedAssemblyInfo.cs'
C:\hostedtoolcache\windows\GitVersion.Tool\5.12.0\dotnet-gitversion.exe --roll-forward Major D:/a/2/s/My.Project /output json /l console /config D:\a\2\s\azdtasks\PipelineTemplates\GitVersion.yml /updateassemblyinfo D:\a\2\s\My.Project/SharedAssemblyInfo.cs
...
INFO [03/28/25 11:06:58:84] Updating assembly info files
INFO [03/28/25 11:06:58:84] Found 17 files
INFO [03/28/25 11:06:58:93] Done writing

This run finds all of the old AssemblyInfo.cs files within the project which are redundant (yes, they should be removed at some point!). However, it completely misses my SharedAssemblyInfo.cs and it's not one of the 17 files that git version has modified.

command@3

After trying execute@3 I thought I would try assembling the command line myself via command@3.

- task: gitversion/command@3
  displayName: GitVersion@3 - Run
  inputs:
    targetPath: '$(Build.Repository.LocalPath)'
    arguments: '/output json /output buildserver /config $(Build.SourcesDirectory)/azdtasks/PipelineTemplates/GitVersion.yml /diag /updateassemblyinfo $(Build.Repository.LocalPath)/SharedAssemblyInfo.cs /ensureassemblyinfo'
C:\hostedtoolcache\windows\GitVersion.Tool\5.12.0\dotnet-gitversion.exe --roll-forward Major D:/a/1/s/My.Project /output json /output buildserver /config D:\a\1\s/azdtasks/PipelineTemplates/GitVersion.yml /diag /updateassemblyinfo D:\a\1\s\My.Project/SharedAssemblyInfo.cs /ensureassemblyinfo
...
INFO [03/28/25 10:53:49:71] Done writing

This run doesn't update any assembly info files at all.

What is expected?

Documented above.

Steps to Reproduce

See above.

Output log or link to your CI build (if appropriate).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant