ReadFileVersion always returning -1

I want to get the Rhino version of the current file. Every file I try this on returns -1. Using V7. Any ideas?

I don’t know the answer to your ReadFileVersion issue, but as a workaround could you read the file file into a file3dm object and get the Rhino version from that? Here’s a cs partial snippet from a different context that does that reliably:

                    File3dm f3dm = Rhino.FileIO.File3dm.Read(args[0]);
                    if (f3dm is null)
                        throw new InvalidOperationException("Not a valid .3dm file");
                    else
                    {   string fVersion = f3dm.ApplicationName;
                        if (fVersion is null)
                            throw new InvalidOperationException("No Rhino version information in this file");
                        else
                        {   
                            //Console.WriteLine(fVersion);

Thanks, I did find another workaround.

Hi @JimCarruthers,

This is left over Rhino v1, v2, and maybe v3 support. If you have an alternative method, then use it and pretend you’ve never seen this.

– Dale