I have a C# solution, let’s say MySolution and inside this I have 2 projects, let’s say ProjectA and ProjectB. ProjectA is used as a reference for ProjectB.
How can I obtain the version of ProjectB inside the classes from ProjectA ?
I can obtain the version of ProjectB inside the code of ProjectB by using the following syntax :
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version
Or with any other instance (via
instance.GetType().Assembly) or type of someting coming from ProjectB. You can also load the assembly explicitly and then get the version of that.