Skip to content
Discussion options

You must be logged in to vote

As far as I can tell, the problem is that PowerShell current directory (pwd) is not the same as .Net current directory ([System.IO.Directory]::GetCurrentDirectory()). And the .Net class FileVersionInfo expects the path relative to the .Net current directory, which is why it can't find the file.

One way that works for me is to use the absolute path of the file:

> [System.Diagnostics.FileVersionInfo]::GetVersionInfo((gci "$OutFile").FullName).FileVersion
1.0.0.0

Though I don't know PowerShell that well, so there may be a better way to do this.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@RokeJulianLockhart
Comment options

@svick
Comment options

@RokeJulianLockhart
Comment options

Answer selected by RokeJulianLockhart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants