Skip to content

GenerateAssemblyInfo support for InternalsVisibleToAttribute and AssemblyMetadataAttribute #3166

@bryanfarrell

Description

@bryanfarrell

Hello,

In our .NET 4.7.2 applications we set the InternalsVisibleTo attribute on our libraries so that our internal unit test projects can run unit tests on internal methods without having to go through the trouble of putting public signatures of these methods into the class and wrapping everything in preprocessor directives.

We also make use of the AssemblyMetadata attribute to have our build system add vital diagnostic information to our assemblies so that there is never an issue with identifying when a project was built, from what repo commit etc. This has made identifying and fixing bugs much easier more efficient.

To set these values we've manually set the InternalsVisibleTo attribute at design time into the AssemblyInfo.cs file. We also have our build system inject the values into the AssemblyInfo.cs file at build time during the build (but the changes are not committed as the metadata all build version related metadata).

In .NET Standard and Core we've found that the common Assembly Attributes are now set in the project file. Do you have plans to add these other attributes to the Microsoft.NET.GenerateAssemblyInfo.targets file so that they an be included in the project file so the new generate assembly info functionality can support adding these to the output assembly?

We have read there is a workaround where we can set the property GenerateAssemblyInfo to False and add an AssemblyInfo.cs file to the .NET Standard/Core projects but we would rather not use this workaround. For one we do not know how long it will be supported and also we do not know if it will break the new project build workflow in some way.

Can you please provide some advice on how these attributes can be used in .NET Standard/Core project files without the workaround or an indication if you plan on adding support for them to the Microsoft.NET.GenerateAssemblyInfo.targets file?

Thank you,

Bryan

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions