ICLRMetaHost::GetVersionFromFile Method

.NET Framework (current version)
 

Gets an assembly's original .NET Framework compilation version (stored in the metadata), given its file path. This method supersedes the GetFileVersion function.

HRESULT GetVersionFromFile (  
    [in] LPCWSTR pwzFilePath,  
    [out, size_is(*pcchBuffer)] LPWSTR pwzBuffer,  
    [in, out] DWORD *pcchBuffer);  
);  

Parameters

pwzFilePath
[in] The complete assembly file path.

pwzbuffer
[out] The .NET Framework compilation version stored in the metadata, in the format "vA.B[.X]". A, B, and X are decimal numbers that correspond to the major version, the minor version, and the build number. The length of this string is limited to MAX_PATH.

System_CAPS_ICON_note.jpg Note

This output matches the directory name for the .NET Framework version, as it appears under C:\Windows\Microsoft.NET\Framework.

Example values are "v1.0.3705", "v1.1.4322", "v2.0.50727", and "v4.0.X", where X depends on the build number installed. Note that the "v" prefix is required.

pcchBuffer
[in, out] The size of pwzbuffer to avoid buffer overruns.

This method returns the following specific HRESULTs as well as HRESULT errors that indicate method failure.

HRESULTDescription
S_OKThe method completed successfully.
E_POINTERpwzbuffer or pcchBuffer is null.
HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)The buffer is too small.

Platforms: See System Requirements.

Header: MetaHost.h

Library: Included as a resource in MSCorEE.dll

.NET Framework Versions: Available since 4

ICLRMetaHost Interface
Hosting

Show: