Skip to content

Instantly share code, notes, and snippets.

@giansalex
Created June 15, 2020 16:01
Show Gist options
  • Save giansalex/58d445d04d6fc7cd14b36f2151a853b2 to your computer and use it in GitHub Desktop.
Save giansalex/58d445d04d6fc7cd14b36f2151a853b2 to your computer and use it in GitHub Desktop.
Set version number for .net core projects

Setting release version on .net core publish

Build with version parameter.

dotnet publish -c Release -o dist -p:Version=1.0.0.1

read version on Program.

using System;
using System.Reflection;
//...

var version = Assembly.GetEntryAssembly().GetName().Version;
Console.WriteLine("Version: " + version);
// 
// Version: 1.0.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment