I'm developing an ASP.Net Core project, where the .csproj file looks like this:
<PropertyGroup>
  <OutputType>Exe</OutputType>
  <TargetFramework>netcoreapp2.0</TargetFramework>
    <PreserveCompilationContext>true</PreserveCompilationContext>
    <AssemblyName>dummyapp</AssemblyName>
        <Version>17.12.1</Version>
    <RuntimeIdentifiers>centos.7-x64;win7-x64</RuntimeIdentifiers>
</PropertyGroup>
When this app is published for Windows, I can get the version info from its properties. Which shows 17.12.1 as mentioned.
Alternatively I can run wmic datafile where name="filepath/app.exe" get Version /value and get the same version using command prompt.
But is there a standard way to get the same in linux distro?
I've looked into:
- Experimented with this answer. Though it is for file-system! 
- Tried - myapp --versionand- /fullpath/myapp --versionas mentioned in this post. Also tried solutions with the marked duplicates.
After all the trials, it seems, I need to implement something else in the .csproj file so as to get the version info using bash. Can someone point out what needs to be done, or give a hint about the same.
Main method:
public static void Main(string[] args)
{
    var root = new Root();
    var config = new ConfigurationBuilder()
                     .SetBasePath(Directory.GetCurrentDirectory())
                     .AddJsonFile(SettingsFilename, optional: false,
                                  reloadOnChange: true)
                     .AddEnvironmentVariables()
                     .Build();
    config.Bind(root);
    //some codes
    var host = new WebHostBuilder()
                    .UseKestrel()
                    .UseUrls(root.AppUrl)
                    .UseConfiguration(config)
                    .UseContentRoot(Directory.GetCurrentDirectory())
                    .UseIISIntegration()
                    .ConfigureServices(s =>
                                     s.AddRouting().DetectTokenChange(config))
                    .UseSetting(WebHostDefaults.ApplicationKey, "dummyapp")
                    .Configure(app => app.UseRouter(r => r.MapPost("dumptoqueue", 
                                      async (context) => 
                                      await Task.Run(() => AddtoQueue(context)))))
                    .Build();
     host.Run();
}
App built using the command line:
dotnet publish -c release -r centos.7-x64
 
     
    