Environment.Version Propiedad

Definición

Permite obtener una versión que consiste en los números principal, secundario, de compilación y de revisión de Common Language Runtime.

public:
 static property Version ^ Version { Version ^ get(); };
public static Version Version { get; }
static member Version : Version
Public Shared ReadOnly Property Version As Version

Valor de propiedad

Versión de Common Language Runtime.

Ejemplos

En el ejemplo siguiente se muestra la versión de Common Language Runtime.

// Sample for the Environment::Version property
using namespace System;
int main()
{
   Console::WriteLine();
   Console::WriteLine( "Version: {0}", Environment::Version );
}

/*
This example produces the following results:
(Any result that is lengthy, specific to the machine on which this sample was tested, or reveals information that should remain secure, has been omitted and marked S"!---OMITTED---!".)

Version: !---OMITTED---!
*/
// Sample for the Environment.Version property
using System;

class Sample
{
    public static void Main()
    {
    Console.WriteLine();
    Console.WriteLine("Version: {0}", Environment.Version.ToString());
    }
}
// Sample for the Environment.Version property
open System

printfn $"\nVersion: {Environment.Version}"
' Sample for the Environment.Version property
Class Sample
   Public Shared Sub Main()
      Console.WriteLine()
      Console.WriteLine("Version: {0}", Environment.Version.ToString())
   End Sub
End Class

Comentarios

Para .NET Core 3.x y .NET 5 y versiones posteriores, la Environment.Version propiedad devuelve el número de versión del entorno de ejecución de .NET.

Para las versiones 4, 4.5, 4.5.1 y 4.5.2 de .NET Framework, la propiedad Environment.Version devuelve un objeto Version cuya representación de cadena tiene la forma 4.0.30319.xxxxx. Para .NET Framework 4.6 y versiones posteriores, y las versiones de .NET Core anteriores a la versión 3.0, tiene el formato 4.0.30319.42000.

Advertencia

Para .NET Framework 4.5 y versiones posteriores, no se recomienda usar la Version propiedad para detectar la versión del runtime; en su lugar, puede determinar la versión de Common Language Runtime consultando el Registro. Para obtener más información, vea Cómo: Determinar qué versiones de .NET Framework están instaladas.

Para obtener más información sobre la versión de Common Language Runtime que se instala con cada versión de .NET Framework, vea Versiones y dependencias.

Se aplica a