Question

Can anyone suggest a way of getting version information into a Web Service? (VB.NET)

I would like to dynamically use the assembly version in the title or description, but the attributes require constants.

Is manually writing the version info as a string the only way of displaying the information on the .asmx page?

Was it helpful?

Solution

Yeah, attributes cannot have anything but constants in them, so you cannot use reflection to get the version number. The WebServiceAttribute class is sealed too, so you cannot inherit it and do what you want from there.

A solution might be to use some kind of placeholder text as the Name, and set up an MsBuild task to replace it with the version number when building the project.

OTHER TIPS

You need to pick a type in your assembly and then do the following:

typeof(Some.Object.In.My.Assembly).Assembly.GetName().Version;

via reflection you can get the Assembly object which contains the assembly version.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top