Skip to content

[Bug] assembly-informational-format doesn't support special or international characters #2339

@LazaroOnline

Description

@LazaroOnline

The assembly-informational-format doesn't support special or international characters.

Expected Behavior

Product version should just be the text from the template as-is, without replacing special characters, allowing things like:
Some special characters: +-=#![]^&@$%:<>//\\-çñáÁ统

*If there is any particular scenario that has problems with letting special characters in that attribute then I would like to have a configuration parameter to enable/disable special character replacement, but if there is no such case then just keep them and don't replace them.

Actual Behavior

It replaces special characters and international unicode characters by a dash "-".
Using this config: assembly-informational-format: 'Some special characters: +-=#![]^&@$%:<>//\\-çñáÁ统'
Results in:
Product version: Some-special-characters--+------------------------
Losing all information from special chars.

Steps to Reproduce

Create a dotnet project, add GitVersion.Task NuGet and add a GitVersion.yml config (UTF-8 encoded) file with the following text:

assembly-informational-format: 'Some special characters: +-=#![]^&@$%:<>//\\-çñáÁ统'

DotNet does allow any free unicode text

You can confirm that it is not a dotnet limitation by adding special characters to the attribute:
For Full dotnet, in AssemblyInfo.cs:

[assembly: AssemblyInformationalVersion("Some special characters: +-=#![]^&@$%:<>//\\-çñáÁ统")]

Results in: Some special characters: +-=#![]^&@$%:<>//\-çñáÁ统 as expected.

For dotnet Core, in the csproj file:

<InformationalVersion>Some special characters: +-=#![]^@$%://\\-çñáÁ统</InformationalVersion>

Results in: Some special characters: +-=#![]^@$%://\\-çñáÁ统 as expected.

Context

We need to add custom free text version information to the assembly, like:
"demo to customer: Nestlé"
it can have any special character and it should be preserved.

Your Environment

  • Tested with dotnet 4.8 and dotnet core 3.1, same thing occurs in both.
  • Version Used: GitVersionTask 5.3.6
  • Operating System and version Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions