How to show application version in VS.NET Deployment Project?

前端 未结 2 1335
南方客
南方客 2021-01-05 20:36

I have set up a Deployment Project for my application. The problem is that I want to show application version (eg. MyApplication 1.2.3.1) during installation so the user can

2条回答
  •  渐次进展
    2021-01-05 21:22

    You can get the version number that is set in the executing AssemblyInfo.cs using this code

    System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()
    

    Similarly if you want to get the version number for a specific assembly you can use

    System.Reflection.Assembly.GetAssembly([type in my assembly]).GetName().Version.ToString()
    

    You could then change the welcome text automatically at runtime.

提交回复
热议问题