Application.ProductVersion 属性

定义

获取与该应用程序关联的产品版本。Gets the product version associated with this application.

public:
 static property System::String ^ ProductVersion { System::String ^ get(); };
public static string ProductVersion { get; }
member this.ProductVersion : string
Public Shared ReadOnly Property ProductVersion As String

属性值

产品版本。The product version.

示例

下面的代码示例获取此属性,并在文本框中显示其值。The following code example gets this property and displays its value in a text box. 该示例要求将 textBox1 放置在窗体上。The example requires that textBox1 has been placed on a form.

private:
   void PrintProductVersion()
   {
      textBox1->Text = "The product version is: {0}",
         Application::ProductVersion;
   }
private void PrintProductVersion() {
    textBox1.Text = "The product version is: " +
       Application.ProductVersion;
 }

Private Sub PrintProductVersion()
   textBox1.Text = "The product version is: " & _
      Application.ProductVersion
End Sub

注解

版本号通常显示为主编号次版本号内部版本号专用部件号Typically, a version number displays as major number.minor number.build number.private part number. 可以通过设置程序集清单中的程序集版本来显式设置它。You can set it explicitly by setting the assembly version within your assembly manifest. 有关详细信息,请参阅程序集清单For more information, see Assembly Manifest.

ProductVersion 首先看看包含主可执行文件的程序集是否具有 @no__t 的属性。ProductVersion first looks to see if the assembly containing the main executable has the AssemblyInformationalVersion attribute on it. 如果该属性存在,则用于 ProductVersionCommonAppDataPathIf this attribute exists, it is used for both ProductVersion and CommonAppDataPath. 如果此属性不存在,则这两个属性将改用可执行文件的版本。If this attribute does not exist, both properties use the version of the executable file instead.

适用于

另请参阅