Tried some more things, only the GetEntryAssembly locations is returning anything, but that is NOT 'our' DLL. So cannot even get our own version in this way.
GetExecutingAssembly location:
Error GetExecutingAssembly version: The path is not of a legal form.
GetEntryAssembly location: D:\SvcFab\***\ConnectExecutorActor.exe
GetEntryAssembly version: 1.0.0
GetCallingAssembly location:
Error GetCallingAssembly version: The path is not of a legal form.
ElasticsearchClient assembly location:
Error getting assembly version: The path is not of a legal form.
Code:
try
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
string executingAssemblyLocation = executingAssembly.Location;
Context.Log(LogLevel.Error, $"GetExecutingAssembly location: {executingAssemblyLocation}");
string executingAssemblyVersion = FileVersionInfo.GetVersionInfo(executingAssemblyLocation)?.ProductVersion;
Context.Log(LogLevel.Error, $"GetExecutingAssembly version: {executingAssemblyVersion}");
}
catch (Exception ex)
{
Context.Log(LogLevel.Error, $"Error GetExecutingAssembly version: {ex.Message}");
}
try
{
Assembly entryAssembly = Assembly.GetEntryAssembly();
string entryAssemblyLocation = entryAssembly.Location;
Context.Log(LogLevel.Error, $"GetEntryAssembly location: {entryAssemblyLocation}");
string entryAssemblyVersion = FileVersionInfo.GetVersionInfo(entryAssemblyLocation)?.ProductVersion;
Context.Log(LogLevel.Error, $"GetEntryAssembly version: {entryAssemblyVersion}");
}
catch (Exception ex)
{
Context.Log(LogLevel.Error, $"Error GetEntryAssembly version: {ex.Message}");
}
try
{
Assembly callingAssembly = Assembly.GetCallingAssembly();
string callingAssemblyLocation = callingAssembly.Location;
Context.Log(LogLevel.Error, $"GetCallingAssembly location: {callingAssemblyLocation}");
string callingAssemblyVersion = FileVersionInfo.GetVersionInfo(callingAssemblyLocation)?.ProductVersion;
Context.Log(LogLevel.Error, $"GetCallingAssembly version: {callingAssemblyVersion}");
}
catch (Exception ex)
{
Context.Log(LogLevel.Error, $"Error GetCallingAssembly version: {ex.Message}");
}
try
{
Assembly elasticAssembly = typeof(ElasticsearchClient).GetTypeInfo().Assembly;
if (elasticAssembly is null)
{
Context.Log(LogLevel.Error, $"ElasticsearchClient assembly: NULL");
}
string elasticLocation = elasticAssembly.Location;
Context.Log(LogLevel.Error, $"ElasticsearchClient assembly location: {elasticLocation}");
string elasticVersion = FileVersionInfo.GetVersionInfo(elasticLocation)?.ProductVersion;
Context.Log(LogLevel.Error, $"ElasticsearchClient assembly version: {elasticVersion}");
}
catch (Exception ex)
{
Context.Log(LogLevel.Error, $"Error GetCallingAssembly version: {ex.Message}");
}
try
{
Assembly elastic2Assembly = typeof(ElasticsearchClient).Assembly;
if (elastic2Assembly is null)
{
Context.Log(LogLevel.Error, $"elastic2searchClient assembly: NULL");
}
string elastic2Location = elastic2Assembly.Location;
Context.Log(LogLevel.Error, $"elastic2searchClient assembly location: {elastic2Location}");
string elastic2Version = FileVersionInfo.GetVersionInfo(elastic2Location)?.ProductVersion;
Context.Log(LogLevel.Error, $"elastic2searchClient assembly version: {elastic2Version}");
}
catch (Exception ex)
{
Context.Log(LogLevel.Error, $"Error GetCallingAssembly version: {ex.Message}");
}