-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Add System.Diagnostics.FileVersionInfo.GetVersionInfo() to "allow list" as Property Function #3457
Comments
Did you have any Progress with this issue? |
This seems like a reasonable request. One workaround is to set the environment variable Related issue: it might be nice to compare these versions using #3212, but neither is necessary to implement the other. |
Was anyone successful with |
I came across this while trying to find a good way to get the ProductVersion of
|
FileVersionInfo on Windows reads the VERSIONINFO resource, but the implementation for Unix reads managed assembly metadata instead and does not see any version information in unmanaged files like notepad.exe, or in .NET single-file executables. Using FileVersionInfo can thus make a build system less portable. I'm not sure making that easier to use is a good idea. OTOH, if your build system already requires Windows and needs to read the Win32 version information of vc_redist.x64.exe, then FileVersionInfo is cheaper than writing your own PE and VERSIONINFO parsers. If you cannot use |
Yes, I've been trying to make the inline task fit into my project with no luck so far. The task itself works fine, however I'd like to use the output (the ProductVersion String) in |
If it is difficult to set |
Steps to reproduce
Project file
Expected behavior
Run
Actual behavior
Build started 6/25/2018 7:20:06 PM.
Project "C:\Test\test.proj" on node 1 (default targets).
Start:
2018.06.25
C:\Test\test.proj(5,12): error MSB4212: Invalid static method invocation syntax: "[System.Diagnostics.FileVersionInfo]::GetVersionInfo('notepad.exe').FileVersion". The type "System.Dia
gnostics.FileVersionInfo" is either not available for execution in an MSBuild property function or could not be found.
Done Building Project "C:\Test\test.proj" (default targets) -- FAILED.
Build FAILED.
Justification
My SDK is built in a strange way, in which, timestamp is not a reliable way to tracked incremental build nor updates. The solution is to either create a version.txt on disk that changes every run or get the version from an adjacent .dll or .exe. System.Diagnostics.FileVersionInfo offer such feature as a direct static call. It returns a string that represents the version.
The text was updated successfully, but these errors were encountered: