How to get the current runtime version in a WinForms application using C#

2 Answers

0 votes
namespace WinFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show($"Runtime Version: {Environment.Version}");
        }
    }
}


/*
run:
 
Runtime Version: 7.0.10

*/

 



answered Jul 2 by avibootz
0 votes
using System.Runtime.InteropServices;

namespace WinFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show($"Framework Description: {RuntimeInformation.FrameworkDescription}");
        }
    }
}


/*
run:
 
Framework Description: .NET 7.0.10

*/

 



answered Jul 2 by avibootz
...