CharsetDetector / UTF-unknown

Character set detector build in C# - .NET 5+, .NET Core 2+, .NET standard 1+ & .NET 4+

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use full version for FileVersion

i2van opened this issue · comments

Assembly/file version is incorrect:

Should be 2.4.0 but 2.0.0 instead.

UPDATE: See this comment for clarification.

Hey,

What do you mean? This looks correct to me:

image

2.0.0 instead.

That one will be patched, see <!-- patched in AppVeyor.yml --> in the csproj

ILSpy for different .NET frameworks:

// UtfUnknown, Version=2.0.0.0, Culture=neutral, PublicKeyToken=90217ce7a23260d4
[assembly: TargetFramework(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")]
[assembly: AssemblyFileVersion("2.0.622")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: TargetFramework(".NETCoreApp,Version=v3.0", FrameworkDisplayName = "")]
[assembly: AssemblyFileVersion("2.0.622")]
[assembly: AssemblyVersion("2.0.0.0")]

AssemblyVersion is 2.0.0.0.

<!-- patched in AppVeyor.yml --> seems to be related to next line which is DebugType tag.

Hey,

What do you mean? This looks correct to me:

image

See Assembly Attributes tab to the right, AssemblyFileVersion field value is 2.0.622

AssemblyVersion is 2.0.0.0.

Yes, that correct and on purpose. It's will only change every major version.

AssemblyFileVersion field value is 2.0.622

Also good. It's the build number.

Please explain what you're trying to achieve.

And what is the purpose may I ask? BTW, NLog has correct AssemblyFileVersion number.

@i2van hello!

nuget version != assembly version

assembly version is required for strong name

https://saebamini.com/how-to-version-your-net-nuget-packages-libraries-and-assemblies-azure-yaml-pipelines-example-using-net-core-cli/

Quote from article:

File Version follows the same versioning schema as Assembly Version and has the same limitations, so you can’t use this one for proper SemVer versioning either. But for consistency and preventing user confusion, I recommend keeping the {Major}.{Minor}.{BuildNumber} parts of this attribute in sync with the {major}.{minor}.{patch} from your semantic version.

Combining the above information and after trying many different approaches through the years, I’ve found the below strategy to be at the sweet spot of versioning NuGet packages and .NET assemblies:

Set your NuGet package version to the {major}.{minor}.{patch}-{tag} part of your Semantic Version
Follow the SemVer specs for bumping the {major}, {minor} and {patch} parts
Set your AssemblyVersion to {major}.0.0.0
Set your FileVersion to {major}.{minor}.{patch}.0

So, the article you mentioned suggests to set FileVersion to {major}.{minor}.{patch}.0 (which is AssemblyFileVersion attribute).

I see no reason for File Version to diverge from Product Version, especially when product consists of single assembly. Besides it's convenient to quick peek on file version during deployment testing without opening file in ILSpy, etc.

Clarification: I suggest changing FileVersion (not AssemblyVersion, thanks for the article), thus I synched title.

The file version is synced with the build version. This is great feature, as we know which build produced this output.

Also updating the build version (we do that in NLog, but it's cumbersome and won't be the case in NLog 5)

I don't see really a benefit in changing this to {Major}.{Minor}.{BuildNumber}, and it only will change automatic work to manually (which is error prone)

as mentioned, this is by design, nothing goes wrong, and updating every release this version is unneeded and error-prone manual work.