Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I access the assembly version and name from inside the assembly/WCF service?

Tags:

c#

wcf

I would like to provide an operation contract in my WCF library that returns select information, i.e. version, assembly name, some other internal values.

The purpose is to provide a "Service Check" method for diagnostics and such that can be called as a regular WCF.

I am having trouble figuring out the best way to do this. I imagine some sort of internal reflection.

I would also like to put this code inside the Interface as part of the operation contract.

What is the best way to do this?

like image 635
John S Avatar asked Feb 17 '23 07:02

John S


1 Answers

You can do this using reflection:

For example, to get the assembly's version info:

return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version
like image 136
STLDev Avatar answered Apr 09 '23 22:04

STLDev