API Support Forum
OEC API > API Support > Querying API version
Author Topic: Querying API version
(7 messages, Page 1 of 1)
Moderators: VPfau
jlanawalt
Posts: 88
Joined: Feb 12, 2009


Posted: Mar 26, 2014 @ 01:06 PM             Msg. 1 of 7
Hi,

Is there a method for asking the API what it's version is?

I looked through the documentation but may have overlooked it.

Thank you,

--
Jacob Anawalt
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Mar 26, 2014 @ 01:09 PM             Msg. 2 of 7
Hi. You can get version from .NET assembly info

Victor Vins
Lead Software Developer
jlanawalt
Posts: 88
Joined: Feb 12, 2009


Posted: Mar 26, 2014 @ 01:52 PM             Msg. 3 of 7
Like this?

System.Version v = System.Reflection.Assembly
.GetAssembly(oecClient1.GetType()).GetName().Version;


--
Jacob Anawalt
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Mar 26, 2014 @ 02:02 PM             Msg. 4 of 7
Yes, this is correct. We increment this version every time when publish it to NuGet

Victor Vins
Lead Software Developer
jlanawalt
Posts: 88
Joined: Feb 12, 2009


Posted: Mar 26, 2014 @ 02:30 PM             Msg. 5 of 7
Is it the Assembly File Version that is updated, or also the Assembly Version?

That code returns v = {3.5.0.0}

I checked out the OEC API Example from GitHub and added that call in InitializeComponent of MainForm.Designer.cs, just after oecClient1 is created. I copied API.dll, CommLib.dll, and ProtoSharp.Core.dll from Trader Demo 3.5 (3.5.12.2).

Using this code:


System.Reflection.Assembly oecapiAssembly = System.Reflection.Assembly
.GetAssembly(oecClient1.GetType());
System.Version v = oecapiAssembly.GetName().Version;
System.Diagnostics.FileVersionInfo fvi =
System.Diagnostics.FileVersionInfo.GetVersionInfo(oecapiAssembly.Location);


I get:
v = {3.5.0.0}
fvi.FileVersion = "3.5.13.0"

The FileVersion matches API.dll Windows Explorer Properties for the File version and Product version.

The docs said I could copy the assemblies from OEC Trader or use NuGet. I can use NuGet if that would have a different result.

--
Jacob Anawalt
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Mar 26, 2014 @ 03:03 PM             Msg. 6 of 7
Oops, sorry for this mess with my previous response. As you correctly noted, we increment "file version", not "assembly version".

Victor Vins
Lead Software Developer
jlanawalt
Posts: 88
Joined: Feb 12, 2009


Posted: Mar 26, 2014 @ 03:17 PM             Msg. 7 of 7
The Assembly tags at the top of the pages in the API documentation make more sense now:

Assembly: API (in API.dll) Version: 3.5.0.0 (3.5.12.0)

Thank you for putting that and the version history in there.

I noticed that starting in September of 2013 you began incrementing the API.dll and CommLib.dll assembly file versions and noting those versions in the change logs. It is also appreciated.

--
Jacob Anawalt