I am working on a set of web pages that use a shared library.
To test the deployment, I need to add version information to the generated html. A method that adds a version watermark to a page is a shared library.
So, I have something like this (this is harder because the shared library has a base class for web pages, but we can simplify it for this task):
In control from mainAssembly.dll, I call the OnInit method:
protected override void OnInit(EventArgs e) { .. Library.AddWatermark(this); .. }
and in the shared library I have:
public void AddWatermark(Control ctrl) { string assemblyVersion = GetAssemblyVersion(); ctrl.Controls.Add(new HiddenField { Value = string.Format("Version: {0}", assemblyVersion ) }); }
So my question is: how to get the version of the assembly when we are in the method from this assembly? (in AddWatermark)? And if you can get the callerโs build version? (MainAssembly)
source share