Skip to content
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

[Bug] Updating Assembly info specifying file resulting in duplicate attributes being defined. #2278

Closed
shaneholder opened this issue May 17, 2020 · 7 comments
Labels

Comments

@shaneholder
Copy link

Updating Assembly info specifying file resulting in duplicate attributes being defined.

The command line being executed is:

F:\agents\agent00_work_tool\GitVersion.Tool\5.3.3\x64\dotnet-gitversion.exe F:/agents/agent00/_work/12/s /output json /output buildserver /updateassemblyinfo F:\agents\agent00_work\12\s/CommonAssemblyInfo.cs

and at the end of the log I see:

INFO [05/17/20 14:26:17:15] Updating assembly info files
INFO [05/17/20 14:26:17:15] Found 51 files
INFO [05/17/20 14:26:18:21] Done writing

and the errors are CS0579: Duplicate AssemblyVersion, AssemblyFileVersion, AssemblyInformationalVersion attribute

Perhaps I'm missing an option in the build?

Your Environment

Azure Devops:
The following two tasks are configured. I have been using the original GitVersion task for a few years now and I'm just now updating to the new gittools tasks.

steps:
- task: gittools.gittools.setup-gitversion-task.gitversion/setup@0
  displayName: gitversion/setup
  inputs:
    versionSpec: 5.x
  enabled: false

steps:
- task: gittools.gittools.execute-gitversion-task.gitversion/execute@0
  displayName: gitversion/execute
  inputs:
    updateAssemblyInfo: true
    updateAssemblyInfoFilename: '$(Build.SourcesDirectory)/CommonAssemblyInfo.cs'
  enabled: false
@Crossbow78
Copy link

We have a similar step in our Azure build pipeline, and what I noticed is that GitVersion 5.3.2 no longer honors the updateAssemblyInfoFilename argument, and updates any 'AssemblyInfo.cs' it finds, instead of our specified 'SharedAssemblyInfo.cs'.

Had some hope that this was covered in #2270, but the issue is still present in 5.3.3.

We reverted to GitVersion 5.2.4 which works fine.

@Miles-Davies-HORIBA
Copy link

Hi, to add to this we use the /updateassemblyinfofilename argument followed by a relative path to the git root to a single file. This file is shared by all our projects so we have common version information.
Recent builds have either thrown an invalid argument exception or ignored the file path and just written over any file named "AssemblyInfo.cs" in the entire source tree. This is 100s of files in our case and is not what I would expect.
I think if the approach to handling arguments changes from a file path to a glob pattern maybe a new argument should be used to make it explicit? At the very least the help should be updated to reflect this change. Currently -help describes arguments that cannot be used :-(

@pietergheysens
Copy link

Same issue using GitVersion.Tool 5.3.5 x64. The UpdateAssemblyInfoFilename is a valid path but it's ignored during the process. It scans for the regular project AssemblyInfo files and updates these individually. Build fails with the "Duplicate" version attribute errors.

@mcnallys
Copy link

Experiencing the same issue on 5.3.7.

@dsbut
Copy link

dsbut commented Jul 15, 2021

I've encountered the very same issue with:

  • GitVersion 5.6.10
  • gitversion/execute@0
  • x64
  • On the MS-hosted windows-latest agent

I've had to resort to including a second third-party task (Assembly-Info-NetFramework@2) in order to update a SharedAssemblyInfo.cs file.

@asbjornu
Copy link
Member

A pull request fixing this would be highly appreciated. 🙏🏼

@arturcic
Copy link
Member

arturcic commented Apr 8, 2023

#2841 resolved this.

@arturcic arturcic closed this as completed Apr 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants