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] Cannot specify assembly info file name in Azure DevOps Pipelines task (spec 5.6.10) #2769

Closed
voodooprogramming opened this issue Jul 20, 2021 · 2 comments
Labels

Comments

@voodooprogramming
Copy link

Describe the bug
Solution build fails after gitversion/execution due to version attributes duplication.

Expected Behavior

Version attributes are set only in 1 file specified with /updateassemblyinfofilename argument.

Actual Behavior

Version attributes are set in all the AssemblyInfo.cs files + in file specified with /updateassemblyinfofilename argument.
Build fails because of the version attributes duplication

Error CS0579: Duplicate 'AssemblyVersion' attribute
Error CS0579: Duplicate 'AssemblyFileVersion' attribute
Error CS0579: Duplicate 'AssemblyInformationalVersion' attribute

Steps to Reproduce

Here's the task configuration YAML:

steps:
- task: gittools.gittools.execute-gitversion-task.gitversion/execute@0
  displayName: gitversion/execute
  inputs:
    useConfigFile: true
    configFilePath: src/GitVersion.yml
    updateAssemblyInfo: true
    updateAssemblyInfoFilename: '$(Build.SourcesDirectory)\src\SharedAssemblyInfo.cs'

And command it produced upon execution:

dotnet-gitversion D:/a/1/s /output json /output buildserver /config D:\a\1\s\src\GitVersion.yml /updateassemblyinfo D:\a\1\s\src\SharedAssemblyInfo.cs

I also tried to pass arguments via Additional GitVersion arguments field, but no success either:

dotnet-gitversion D:/a/1/s /output json /output buildserver /config D:\a\1\s\src\GitVersion.yml /updateassemblyinfofilename D:\a\1\s\src\SharedAssemblyInfo.cs
Unhandled exception. GitVersion.WarningException: Could not parse command line parameter '/updateassemblyinfofilename'.

Context

The solution contains 13 projects. AssemblyInfo.cs files without versioning attributes in all the 13 projects are linked to the SharedAssemblyInfo.cs file with versioning attributes.

I'm trying to target SharedAssemblyInfo.cs only, but all the assembly info files are modified instead.

Your Environment

  • Version Used: gitversion/setup 0.9.10, gitversion/execute 0.9.10 with version spec 5.6.10
  • Operating System and version: Microsoft Windows Server 2016
@asbjornu
Copy link
Member

asbjornu commented Jul 20, 2021

Seems like this duplicates #1802, #2512 and/or #2278. Please see #2163 (comment) for a possible solution.

@voodooprogramming
Copy link
Author

I got a little bit too fixated on the idea of sharing version info.
I've brought version attributes back to each individual AssemblyInfo.cs and removed SharedAssemblyInfo.cs. Now it works just fine :)

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

2 participants