--version-suffix not changing Assembly version neither assembly file version
Steps to reproduce
dotnet build --version-suffix [anything]
Expected behavior
Assembly version and Assembly file version are set to version-[anything]
Actual behavior
Assembly version and assembly file version are: version.0
to clarify, using dotnet build --version-suffix 9 will not change the assembly version nor the assembly file version, if put it manually with a dot "version": "1.0.0.9" in the project json it works.
--version-suffix never changes assembly version or assembly file version, being numeric or not.
Environment data
dotnet --info output:
.NET Command Line Tools (1.0.0-preview1-002702)
Product Information: Version: 1.0.0-preview1-002702 Commit Sha: 6cde21225e
Runtime Environment: OS Name: Windows OS Version: 10.0.10586 OS Platform: Windows RID: win10-x64
Share project.json please
Note: if i put "1.0.0.[anynumber]" in the project.json the version in the assembly and assembly fileversion is put correctly
Note2 if i put "1.0.0-[anything]" in the project.json it does the same thing than --version-suffix,
{
"title": "■■■■■",
"description": "■■■■■",
"authors": [
"■■■■■"
],
"version": "1.0.0-*",
"copyright": "■■■■■",
"packOptions": {
"projectUrl": "■■■■■",
"licenseUrl": "■■■■■",
"requireLicenseAcceptance": false,
"tags": [ "■■■■■", "■■■■■", "■■■■■", "■■■■■" ]
},
"webroot": "wwwroot",
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0-rc2-3002702",
"type": "platform"
},
"■■■■■": "1.0.0-*",
"■■■■■": "1.0.0-*",
"■■■■■": "1.0.0-*",
"Microsoft.Extensions.Configuration": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Identity": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.WebListener": "0.1.0-rc2-final",
"Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
"Microsoft.Extensions.Caching.Abstractions": "1.0.0-rc2-final",
"Microsoft.Extensions.Caching.Memory": "1.0.0-rc2-final",
"Serilog.Extensions.Logging": "1.0.0-rc2-10104",
"Microsoft.ApplicationInsights.AspNetCore": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Antiforgery": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Authorization": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Cors": "1.0.0-rc2-final",
"Serilog.Sinks.RollingFile": "2.0.0-rc-703",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview1-final",
"type": "build"
},
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview1-final",
"type": "build"
},
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview1-final",
"type": "build"
},
"System.Resources.ResourceManager": "4.0.1-rc2-24027",
"Swashbuckle": "6.0.0-beta9",
"■■■■■.■■■■■.■■■■■": "1.0.0-*"
},
"tools": {
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview1-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true,
"embed": {
"mappings": {
"■■■■■.Countries": "Resources\\Countries.resx",
"■■■■■.■■■■■ResourceStrings": "Resources\\■■■■■ResourceStrings.resx"
}
},
"warningsAsErrors": true
},
"runtimeOptions": {
"gcServer": true,
"gcConcurrent": true
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"■■■■■\\**\\Views\\",
"appsettings.json",
"web.config",
"■■■■■.xml"
],
"exclude": [
"node_modules"
],
"publishExclude": [
"node_modules",
"bower_components",
"content",
"**.xproj",
"**.user",
"**.vspscc",
"**.log",
"**.pubxml",
"**.ps1"
]
},
"scripts": {
"postrestore": [
"npm install",
"npm install bower",
"npm install gulp"
],
"prepublish": [
"bower install",
"gulp clean",
"gulp sass",
"gulp min",
"gulp copy"
],
"postpublish": [
"dotnet publish-iis --publish-folder ..\\..\\publish\\ --framework %publish:FullTargetFramework%"
]
}
}
File and assembly version numbers only support four-part numeric version numbers. Semantic versions are not applicable and therefore ignored.
If i use dotnet build --version-suffix 9 It will not change the assembly version nor the assembly file version, if i put it manually with a dot "version": "1.0.0.9" in the project json it works.
to clarify, --version-suffix never changes assembly version or assembly file version, being numeric or not.
cc @piotrpMSFT cc @brthor
dotnet/cli#3620
Any help here?
Actually, it changes the version but "Product version" (see attached). And I don't know how to read this version from the assembly.

@ctrl-brk - I use this to get the product version (I don't know if this is platform-agnostic, though):
string productVersion =
typeof(SomeClassInYourAssembly)
.GetTypeInfo().Assembly
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
.InformationalVersion;