0

I'm writing a dll which will be used in several environments, namely from our build machine. The program is responsible for getting a file's FileVersion. I'm using the following code within the .dll:

public string GetVersion(string filePath)
{
  FileVersionInfo temp = FileVersionInfo.GetVersionInfo(filePath);
  return temp.FileVersion;
}

Now when I run this function from the WPF test application I wrote everything works correctly; all values are filled out for the FileVersionInfo object.

However when I run this exact same function from within a Console Application project all the values in the FileVersionObject are null.

Anyone have any idea what's going on?

Ben K.
  • 273
  • 3
  • 10
  • This question has some interesting suggestions, but it doesn't look like the issue was ever solved: http://stackoverflow.com/questions/2221598/fileversioninfo-getversioninfo-incorrect-in-console-application – George Oct 01 '12 at 13:14

1 Answers1

0

I figured it out actually, the way I was retrieving the file path from the console was incorrect, I had a space character at the end of the directory name. I feel pretty dumb about it o.O

Ben K.
  • 273
  • 3
  • 10
  • Which is odd, because File.Exists passed on this incorrect path, and the FileVersionInfo.GetVersionInfo didn't throw an error on it either. – Ben K. Oct 01 '12 at 13:42