Skip to content

Unable to set multiple of the same attribute CustomAttributes in AssemblyInfo creator #4071

Closed

Description

@squid-box

Prerequisites

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

Cake runner

Cake .NET Tool

Cake version

3.0.0

Operating system

Windows

Operating system architecture

64-Bit

CI Server

No response

What are you seeing?

I'm trying to set two attributes for SupportedOSPlatform (with different values) in my AssemblyInfo generated through Cake, by adding them as CustomAttributes.

It seems only the last value added to this list is actually added to the assembly info, and from a brief look at this class I guess it comes from the custom attributes being stored in a Dictionary?

What is expected?

I expect to have all the custom attributes I specify added to my AssemblyInfo file, even if they have multiple instances of the same attribute.

Steps to Reproduce

Trivial example:

CreateAssemblyInfo(File("SomeDir/My_AssemblyInfo.cs"), new AssemblyInfoSettings
{
    Version = "1.2.3.4",
    Company = "MyCompany",
    CustomAttributes = new List<AssemblyInfoCustomAttribute>
    {
        new AssemblyInfoCustomAttribute
        {
            Name = "SupportedOSPlatform",
            NameSpace = "System.Runtime.Versioning",
            UseRawValue = false,
            Value = "windows"
        },
        new AssemblyInfoCustomAttribute
        {
            Name = "SupportedOSPlatform",
            NameSpace = "System.Runtime.Versioning",
            UseRawValue = false,
            Value = "linux"
        },
    }
});

Output log

No response

Activity

  1. changed the title [-]Unable to set multiple CustomAttributes in AssemblyInfo creator[/-] [+]Unable to set multiple of the same attribute CustomAttributes in AssemblyInfo creator[/+] on Nov 15, 2022
  2. squid-box commented on Nov 22, 2022

    @squid-box
    ContributorAuthor

    I'm not sure if the correct approach here is to make it possible to have several instances of the same attribute in CustomAttributes, or introduce a new (collection) property specifically for the SupportedOSPlatform attribute.

  3. added this to the v6.1.0 milestone on Feb 25, 2026
  4. github-actions commented on Mar 1, 2026

    @github-actions

    🎉 This issue has been resolved in version v6.1.0 🎉

    The release is available on:

    Your GitReleaseManager bot ðŸ“Ķ🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions