Please see below the function I have for writing a layer file. I'd like to embedded a version number that would be accessible on the Ilayer loaded into ArcMap (from the layer file). The intention being, that we could force symbology updates on existing MXDs by checking the version and reloading \ updating where necessary.
Any help with how to include the version number would be appreciated.
Thanks
Chris
Public Function SaveToLayerFile(ByVal layerFilePath As System.String, ByVal layer As ESRI.ArcGIS.Carto.ILayer) As String
Try
If layer Is Nothing Then
Return "Null Layer"
End If
'create a new LayerFile instance
Dim layerFile As ESRI.ArcGIS.Carto.ILayerFile = New ESRI.ArcGIS.Carto.LayerFileClass
'make sure that the layer file name is valid
If System.IO.Path.GetExtension(layerFilePath) <> ".lyr" Then
Return "Bad Path"
End If
If layerFile.IsPresent(layerFilePath) Then
System.IO.File.Delete(layerFilePath)
End If
'create a new layer file
layerFile.New(layerFilePath)
'attach the layer file with the actual layer
layerFile.ReplaceContents(layer)
'save the layer file
layerFile.Save()
Catch ex As Exception
Return ex.Message
End Try
Return "Success"
End Function