None of what used to work in RC.x helps anymore.
I have tried these:
PlatformServices.Default.Application.ApplicationVersion;
typeof(Controller).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyFileVersionAttribute>().Version;
They all return 1.0.0.0 instead of 1.0.0-9 which should be after execution of the dotnet publish --version-suffix 9
having this in project.json: "version": "1.0.0-*"
Basically they give me "File version" from the attached picture instead of "Product version" which dotnet publish
actually seems to change.
Checking the Version of Your .Open your project's source folder and, in the address bar, type "cmd" and press Enter. It will open the command prompt with the project path. Execute the following command: dotnet --version . It will display your project's current SDK version,i.e., 2.1.
The default versioning scheme is Query String Parameter Versioning. We've already set a name for the query string parameter (api-version) that we are going to use to send versioning information. We use the [ApiVersion("1.0")] attribute to set the version of the controller.
Since ASP.NET Core 3.1, you have the ability to version your APIs using a Microsoft NuGet package. Learn how to use this package to version your APIs easily.
For version 1.x:
Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
For version 2.0.0 this attribute contains something ugly: 2.0.0 built by: dlab-DDVSOWINAGE041
so use this one:
typeof(RuntimeEnvironment).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyFileVersionAttribute>().Version;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With