Get Version Number.
-
I have designed a .Net web service and the client is requesting a new web method to return the web service version number? My web service code consists of the following:
<WebMethod(Description:="Get Web Service Version Number.")> _ Public Function GetVersion() As String Dim sValue As String sValue = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() Return sValue End Function
The problem is this returns “0.0.0.0”. I have tried the following in the assembily.vb file with no luck:'<Assembly: AssemblyVersion("1.0.*")> <Assembly: AssemblyVersion("*")>
Can anyone tell me what I’m doing wrong. Thanks, Jason W. -
I have designed a .Net web service and the client is requesting a new web method to return the web service version number? My web service code consists of the following:
<WebMethod(Description:="Get Web Service Version Number.")> _ Public Function GetVersion() As String Dim sValue As String sValue = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() Return sValue End Function
The problem is this returns “0.0.0.0”. I have tried the following in the assembily.vb file with no luck:'<Assembly: AssemblyVersion("1.0.*")> <Assembly: AssemblyVersion("*")>
Can anyone tell me what I’m doing wrong. Thanks, Jason W.The code you have should work perfectly. AssemblyVersion("*") isn't valid however. I actually got a compiler error when I tried to use it. The asterisk in the default tells the compiler to automatically increment the version as you build.. 1.0.4.3333 1.0.4.3334 ...etc... Use AssemblyVersion("1.0.*") or specify the full version ("1.0.0.0") If you debug your web service, do you also see 0.0.0.0 returned to string sValue?
-
The code you have should work perfectly. AssemblyVersion("*") isn't valid however. I actually got a compiler error when I tried to use it. The asterisk in the default tells the compiler to automatically increment the version as you build.. 1.0.4.3333 1.0.4.3334 ...etc... Use AssemblyVersion("1.0.*") or specify the full version ("1.0.0.0") If you debug your web service, do you also see 0.0.0.0 returned to string sValue?
Now why didn’t that work the other day? It works now. Thanks for the help. Jason W.