The question is, when your assembly is executing, how do you figure out the assembly version and file version of your own assembly?
Your assembly (while executing) can be returned from System.Reflection.Assembly.GetExecutingAssembly(). So:Assembly Version: Assembly.GetExecutingAssembly().GetName().VersionFile Version: System.Diagnostics.FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location)
Of course, this works. But personally, I think it sucks that you need API to get properties of yourself. So here are two suggestions to not use API for those.
1. define a internal class, with only constant class members. It can include your assembly version number, and file version number, please all the interesting assembly properties. Whenever you need to reference your own assembly properties, you use that class.
The downside is that whenever you change the assembly properties, you have to change two places, one in AssemblyInfo.cs, and one in this internal class. But this works well for small projects.
2. Observe the downside of 1), you can do something better. You can have one file describing all the assembly properties. The file can be plain text, or XML, anything, you define it. Before you build your assembly, you run a script that parses that file, and geneates the AssemblyInfo.cs, your internal class. You still reference the assembly properties of your own assembly from that class. When you need to change your properties, you change that file, everything automatically works.