Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Why the package version contains "random" additional information? [duplicate]

$
0
0

I have created a very simple console application in .NET 8 to illustrate the problem I encounter. Simply ran dotnet new console and added a "Version" element in the .csproj, so it contains:

<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><OutputType>Exe</OutputType><TargetFramework>net8.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable><Version>1.2.3-alpha</Version></PropertyGroup></Project>

Now I want to programmatically get the package version recorded in Version element. I saw on another stackoverflow thread that the code to do so is:

using System.Reflection;var version = Assembly.GetEntryAssembly()    .GetCustomAttribute<AssemblyInformationalVersionAttribute>()    .InformationalVersion;Console.WriteLine(version);

But when I run this, instead of getting 1.2.3-alpha as expected, I get 1.2.3-alpha+9d1761b41223159ec45d7d492e08820f706d7ad1.

How can I get only the package version without this extra "random" information ?

PS: I have tested with .NET 5 and .NET 6 and the result is the same.


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>