Computing: DOS, OS/2 & Windows Programming

Installing Visual Studio 2019 on Windows 8.1.

"Visual Studio is an integrated development environment (IDE) from Microsoft. It can be used to develop console and graphical user interface applications along with Windows Forms applications, web sites, web applications, and web services in both native code, and together with managed code for all platforms supported by Microsoft Windows, Windows Phone, Windows CE, .NET Framework, .NET Compact Framework and Microsoft Silverlight."

The paragraph above is how Visual Studio is described in Introduction to Visual Studio and C#, by Hans-Petter Halvorsen (the book is available as PDF on the Internet). I'm not sure, but I suppose that ".NET Compact Framework" actually refers to .NET Core, which makes it possible to build C# applications that are portable to Linux and macOS.

Visual Studio Community Edition is free of charge. The latest version that is compatible with Windows 8.1 is Visual Studio 2019 (Visual Studio 2022 is no longer supported). I don’t know why, but I actually downloaded it from techspot.com. Maybe, that it isn't any longer available at the Microsoft site? I successfully installed it on my Windows 8.1 (French language) VMware Workstation 16 virtual machine.

The download file is a web-setup program, that actually downloads Visual Studio Installer. This program will stay on your computer (and be available in Windows Start menu), allowing to modify your Visual Studio installation, i.e. add or remove components. In the first window of the web-installer, you have links to view the Microsoft privacy declaration and the license terms.

Visual Studio 2019 on Windows 8.1 - Downloading Visual Studio Installer

Microsoft Visual Studio is extremely huge (my installation on Windows 8.1 needs more than 47.5 GB of disk space!), but you can limit the download and the installation, by choosing the components that you actually need resp. want to install. In the first tab of Visual Studio Installer, you can choose the workloads (French: "charges de travail"). If you intend to use Visual Studio to build web applications, you'll have to install the Web and ASP.NET development workload. The workload .NET desktop development is intended for programming in C#, F#, and Visual Basic .NET. Other workloads are intended for programming in C++, or Python. After having chosen the workloads, use the second tab to choose individual components. Besides fine-tuning the workloads installation, you can select some special components, as for example, C++ for Linux or iOS, or a Google Android emulator.

Visual Studio 2019 on Windows 8.1 - Visual Studio Installer: Workloads selection

On the third tab, you can choose to include additional languages; besides French (the language of my Windows), I selected English.

And finally, on the fourth tab, you can choose the installation directories. Apart from the download cache (French: "cache de téléchargement), that you may choose where you want, keeping the downloads or not, you should accept the default locations. There is an important combobox at the left of the Install button: it allows the choice between downloading everything and then starting the installation, or starting to install while still downloading. This last option lets you win time, of course, but I think that you should only choose it if your computer has the necessary power.

Visual Studio 2019 on Windows 8.1 - Visual Studio Installer: Installation directories

I did the entire download before starting the installation. The screenshot below shows the moment where the downloads were terminated, and where I got the warning message that the component Miniconda will not get any security updates, as it is no longer supported.

Visual Studio 2019 on Windows 8.1 - Visual Studio Installer: Download terminated (and warning concerning 'Miniconda')

The rest of the tutorial shows how to create a simple command line project, using C#. On the entry page of Visual Studio, choose Create a new project (French: "Créer un projet").

Visual Studio 2019 on Windows 8.1 - Simple C# project: Choosing to create a new Visual Studio project

On the following page, you choose what type of project you want to create. Depending on the components, that you did install, the list of available project types may be very long; you can limit it by programming language, platform, and type. In our case, we have to choose C# Console App (French: "Application console C#"). This project will be build upon the .NET Core Framework, thus with this framework installed being portable to Linux and macOS.

Visual Studio 2019 on Windows 8.1 - Simple C# project: Choosing to create a Visual Studio C# Consoöe App project

The configuration of the project essentially consists in giving it a name and choosing a project directory. To note, that Visual Studio allows to group several projects as a so called solution. Normally, your project is the solution, thus the checkbox Place the solution and the project in the same directory (French: "Placer la solution et le projet dans le même répertoire") should be selected. By default, Visual Studio solutions are created in the directory C:\Users\<user-name>\source\repos. The name of the solution folder will be the one that we give to the project on this page (I named my solution "HelloWorld"). To note, that this will also be the name of the executable created by the build.

Visual Studio 2019 on Windows 8.1 - Simple C# project: Configuring the new Visual Studio project

In the case of our C# Console App, a supplementary configuration step is required: We have to select the .NET version. On my system, the only choice available was .NET Core 3.1 Framework.

Visual Studio creates the project folders and files, including a C# template file, called Program.cs (this is actually a working "Hello World" program). As you can see on the screenshot, the Visual Studio GUI is rather simple and easy to use (similar to what we old people know from older IDEs, as a difference with the GUI of VSCode with its different views to be selected in the left pane). In Visual Studio, we have all we need in one window. The top-left pane is the editor with the source code. Below, you'll get the messages when building the solution. At the top-right corner, we have the solution explorer. In the pane below you can modify the properties of the item selected in solution explorer.

Visual Studio 2019 on Windows 8.1 - Simple C# project: Project template created by Visual Studio

Two changes that you can make here if you want. First (when your program is executing correctly, what the template code will), change from Debug to Release. Second, you can give your source file another name. To do so, right-click "Program.cs" in the solution explorer, and from the opening context menu, choose Rename. The source file name becomes editable; I changed it to "hello.cs". When renaming the source, a dialog box pops up, asking if you want also to change all references in the project to "Program". Obvious, that this has to be done.

Visual Studio 2019 on Windows 8.1 - Simple C# project: Renaming the C# source file cretaed by Visual Studio

To build the solution, choose Build > Build Solution (French: "Générer > Générer la solution") from the menu. If all goes well, the last line of the build output should contain something like "1 succeeded, 0 failed..." (French: "1 a réussi, 0 a échoué...").

Visual Studio 2019 on Windows 8.1 - Simple C# project: Successful build in Visual Studio

To run the executable resulting form the build from within Visual Studio, choose Debug > Start Without Debugging (French: "Déboguer > Exécuter sans débogage") from the menu. This opens the Visual Studio Debugging Console, where the program is executed.

Visual Studio 2019 on Windows 8.1 - Simple C# project: Successful execution in Visual Studio Debugging Console

As I said, the solution directory has the name given to the solution/project when creating it, in our case "HelloWorld". The C# source (in our case "hello.cs") can be found in this folder (screenshot on the left). The executable, with same name as the solution (in our case "HelloWorld.exe") is somewhere in the "bin" folder, the exact location depending on the project configuration and build options. With the settings being those described in the previous paragraphs (Release built, .NET Core 3.1 Framework), the executable will be created in the directory <project-directory>\bin\Release\netcoreapp3.1 (screenshot on the right).

Visual Studio 2019 on Windows 8.1 - Simple C# project: Project directory with the C# source file
Visual Studio 2019 on Windows 8.1 - Simple C# project: Directory with the executable created by the build

To run the executable in Command Prompt, cd to the directory, where it is located, and enter:
    HelloWorld

Copying the executable to another directory and trying to run it from there, fails with a not existing DLL error. Placing the file "HelloWorld.dll" together with the executable results in another failure (missing configuration files), as shown on the screenshot below.

Visual Studio 2019 on Windows 8.1 - Simple C# project: Failure when trying to run the program from a custom directory (missing files)

In fact, there are two requirements to run this kind of program:

  1. The .NET Core 3.1 Framework must be installed. This is, of course, the case on my French Windows 8.1, but not on my Windows 10, where running the program fails with the message that .NET must be updated.
  2. All Visual Studio generated files located in the directory, where the executable is created, must be copied together with the executable.

The screenshot below shows the successful execution of the program from a random directory on my French language Windows 8.1, after I copied all necessary files to there.

Visual Studio 2019 on Windows 8.1 - Simple C# project: Successful execution of the program from a custom directory (all files copied)

If you find this text helpful, please, support me and this website by signing my guestbook.