FileVersionInfo.ProductMajorPart 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得與這個檔案關聯的產品版本號碼的主要部分。
public:
property int ProductMajorPart { int get(); };
public int ProductMajorPart { get; }
member this.ProductMajorPart : int
Public ReadOnly Property ProductMajorPart As Integer
屬性值
代表產品版本號碼主要部分的值,如果檔案未包含版本資訊,則為 null
。
範例
下列範例會呼叫 GetVersionInfo 以取得 FileVersionInfo [記事本] 的 。 然後它會在文字框中列印 ProductMajorPart 。 此程式代碼假設 textBox1
已具現化。
private:
void GetProductMajorPart()
{
// Get the file version for the notepad.
FileVersionInfo^ myFileVersionInfo =
FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" );
// Print the product major part number.
textBox1->Text = String::Concat( "Product major part number: ", myFileVersionInfo->ProductMajorPart );
}
private void GetProductMajorPart()
{
// Get the file version for the notepad.
FileVersionInfo myFileVersionInfo =
FileVersionInfo.GetVersionInfo(Environment.SystemDirectory + "\\Notepad.exe");
// Print the product major part number.
textBox1.Text = "Product major part number: " + myFileVersionInfo.ProductMajorPart;
}
Private Sub GetProductMajorPart()
' Get the file version for the notepad.
Dim myFileVersionInfo As FileVersionInfo = _
FileVersionInfo.GetVersionInfo(Environment.SystemDirectory + "\Notepad.exe")
' Print the product major part number.
textBox1.Text = "Product major part number: " & myFileVersionInfo.ProductMajorPart
End Sub
備註
一般而言,版本號碼會顯示為「major number.minor number.build number.private part number」。 產品版本號碼是保留版本號碼的64位號碼,如下所示:
前16位是 ProductMajorPart 數位。
接下來的16位是 ProductMinorPart 數位。
第三組 16 位是 ProductBuildPart 數位。
最後16位是 ProductPrivatePart 數位。
這個屬性會取得第一組 16 位。
適用於
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應