GitVersion icon indicating copy to clipboard operation
GitVersion copied to clipboard

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

Open LazaroOnline opened this issue 5 years ago • 2 comments

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

LazaroOnline avatar Jun 24 '20 13:06 LazaroOnline

Related to: https://github.com/GitTools/GitVersion/issues/2199

LazaroOnline avatar Jun 24 '20 16:06 LazaroOnline

I think one viable take on this is to be able to configure the branch name replacement regex as discussed in #1674.

asbjornu avatar Mar 08 '22 17:03 asbjornu

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs.

github-actions[bot] avatar Apr 13 '23 16:04 github-actions[bot]

This issue was closed because it has been stalled for 30 days with no activity. Thank you for your contributions

github-actions[bot] avatar May 14 '23 11:05 github-actions[bot]