Installing And Using .NET 4.7.x, .NET Core 2.0, And C# 7.x With VS 2017

This article explains how to install and use .NET Framework 4.7, .NET Framework 4.7.1, & .NET Core 2.0, and troubleshooting if you are getting an exception while installing these latest components. This article also explains how to use the different versions of C#, e.g. C# 7, C# 7.1, C# 7.2 with Visual Studio 2017 and installing multiple instances of Visual Studio 2017 side by side. 
 
I am going to cover these points in this article.
  1. Installing .NET Framework 4.7
  2. Troubleshooting for the error you might get while installing .NET Framework 4.7
  3. Installing .NET Core 2.0
  4. Installing .NET Framework 4.7.1
  5. Troubleshooting for error occurred while installing .NET Framework 4.7.1
  6. How to install .NET Framework 4.7.1 using windows Insider.
  7. Installing and switching between different versions of C# 7.x.
  8. Installing Visual Studio 2017 “15.3” & Visual Studio 2017 Preview “15.4 preview 4” side by side.

Installing .NET Framework 4.7 

 
I am going to install the .NET Framework 4.7 for Visual Studio 2015 & 2017. Let me explain the process and troubleshooting steps one by one.
 
If you do not have Visual Studio 2017 already installed on your machine, then you can go to the Microsoft official download link for Visual Studio 2017 and install it from there. Since it gets installed successfully, you do not need to worry about troubleshooting. Just make sure to choose all the required components during installation.
 
However, if you have Visual Studio 2017 already installed and you just want to install .NET Framework 4.7 but you are unable to install it due to any reason, then please go through the below steps.
 
Step 1 - Open Visual Studio 2017 and check for the latest framework installed
 
Open Visual Studio 2017 and open the template for creating a console application. Here, you should notice that it is showing I can choose .NET Framework 4.6.2 as the latest version. However, just below the .NET Framework 4.6.2, there is an option to look for more frameworks.
 
.NET Framework
 
Step 2 - Search for more Frameworks
 
Click on the link to search for more Frameworks. It opens a web page -- navigate to the page from where you can download .NET framework 4.7. You'll find that there are 3 options for downloading and installing the .NET framework 4.7. Following is a screenshot from the same link:
 
.NET Framework
 
As you can see, it is showing you 3 options -
  1. Web installer
  2. Offline installer
  3. Windows Update
Step 3 - Download and run installer
  1. Download and run Web Installer
     
    First of all, try with Web Installer. Download the Web Installer and run the downloaded executable file. If it gets installed without any error, then it is okay.
     
    However, if it does not get installed for your Visual Studio 2017, you will see a warning message, as displayed in the following screenshot.
     
    .NET Framework
Then, have patience and be with me. I am going to explain why it is showing this message. However, if you are getting any other message or exception, then I recommend you to update your Visual Studio 2017 first and then retry for the same.
  • Download and run Offline Installer
     
    Now, try with the Offline Installer. You may get the same message.
  • Download Windows Update
     
    Download Windows Update and install it, but still, you may get the same message.
Step 4 - Check for the latest .NET Framework installed on your computer
 
So here, you find an ambiguity as you can see that the installer is saying that .NET Framework 4.7 has been installed already whereas Visual Studio 2017 is showing the latest .NET Framework as .NET Framework 4.6.2. So, you must be thinking which one is correct. For that, you have to check the latest version installed on your machine.
 
Step 5 - Checking the Latest .NET Version Installed on Your machine
 
There are multiple options to check for the latest version installed on your machine. You can check with Visual Studio but it is not the correct version, so you can check with installed files and registry and other configuration options. I would recommend that rather than going through those options, we can check it with a simple console application as well.
 
Open a console application and run the following code.
  1. using Microsoft.Win32;  
  2. using static Microsoft.Win32.RegistryHive;  
  3. using static Microsoft.Win32.RegistryKey;  
  4. using static System.Console;  
  5.   
  6. namespace CheckFrameworkVersion  
  7. {  
  8.     class Program  
  9.     {  
  10.         static void Main(string[] args)  
  11.         {  
  12.             using (RegistryKey key = OpenRemoteBaseKey(LocalMachine, "").OpenSubKey(@"SOFTWARE\Microsoft\NET Framework Setup\NDP\"))  
  13.             {  
  14.                 foreach (string version in key.GetSubKeyNames())  
  15.                 {  
  16.                     if (version.StartsWith("v"))  
  17.                     {  
  18.                         RegistryKey versionKey = key.OpenSubKey(version);  
  19.   
  20.                         if ((string)versionKey.GetValue("Version""") == "")  
  21.                         {  
  22.                             foreach (string subKey in versionKey.GetSubKeyNames())  
  23.                             {  
  24.                                 WriteLine($"  {subKey}  {versionKey.OpenSubKey(subKey).GetValue("Version", "")}");  
  25.                             }  
  26.                         }  
  27.   
  28.                     }  
  29.                 }  
  30.             }  
  31.         }  
  32.     }  
  33. }  
Console Output
 
.NET Framework
 
As you can see, it shows that .NET Framework 4.7 has installed already. However, I am not able to see it in Visual Studio 2017. I am already using the latest version of Visual Studio 2017, so there should not be any reason to update it.
 
Step 6 Install the latest Framework using Visual Studio installer.
 
Open Control panel and go installed programs è  select Visual Studio 2017 and click on modify to open Visual Studio installer. There are other options as well to open the Visual Studio installer.
 
.NET Framework
 
You can see in the preceding screenshot that there is an option to select/deselect components.
Please select the options -
  1. .NET Framework 4.6.2 development tools
  2. .NET Framework 4.7 development tools
You can select only .NET Framework 4.7 but I am selecting both so that I can use both of them interchangeably.
 
Once installation gets completed, please open Visual Studio 2017 and check for the .NET Framework in the drop-down list, as shown in the below screenshot.
 
.NET Framework
 
So, you can see in the screenshot that .NET Framework 4.7 has installed and available for use in Visual Studio 2017. If your machine has Visual Studio 2015 & Visual Studio 2013 as well, then Microsoft.NET Framework 4.7 gets installed for those versions as well.
 
So finally, .NET Framework 4.7 has installed for Visual Studio 2013, 2015, & 2017.
 

Installing .NET Core 2.0

 
Now, I am going to install .NET Core 2.0.
  1. Open Visual Studio 2017 (version 15.3.5 or later)  => File => New Project => Web => ASP.NET Core Web Application.
  2. Select .NET Framework 4.7 & ASP.NET Core Web Application, as shown in the following screenshot.
     
    .NET Framework
  1. Click on the OK button.
  1. It opens a new window where you can choose different versions of ASP.NET Core.
     
    .NET Framework
As you can see in the above screenshot, there are two versions of ASP.NET Core are available.
  1. NET Core 1.0 and
  2. NET Core 1.1
Though ASP.NET Core 2.0 is not available in the dropdown list. You can see in the screenshot that there is an option for downloading .NET Core 2.0. Click on the download link to download it.
 
It redirects you to a new webpage. Following is a screenshot for the same.
 
.NET Framework
 
Click on the link provided after “Install .NET Core 2.0” as shown in the preceding screenshot. It redirects to a new link.
 
.NET Framework
  1. Click on the button “Download .NET Core SDK”. It downloads the .NET Core SDK 2.0. Once the download is completed, please run the downloaded executable file.
     
    .NET Framework
     
    It opens a new window to start the installation and takes 2-5 minutes to complete the installation.
     
    .NET Framework
     
    .NET Framework
     
    Restart the Visual Studio 2017.
     
    Once Visual Studio restarts, you can use ASP.NET Core 2.0. You may have noticed that ASP.NET Core 2.0 has more templates as compared to ASP.NET Core 1.1. Following is a screenshot for the same.
     
    .NET Framework

Installing .NET Framework 4.7.1

 
Now, I am going to install the .NET Framework 4.7.1.
 
You can not install .NET Framework 4.7.1 using the same process which you followed for installing .NET framework 4.7.  As .NET Framework 4.7.1 has not been officially announced and you can install it only through the early access program.
 
Visit the link and find an option for downloading .NET Framework 4.7.1. Download and install it.
 
You may get an error while installing it as displayed in the following screenshot.
 
.NET Framework
 
So if anything is pending for installation, then you need to restart your machine and try to re-install it.
 
I restarted the machine and started the installation again, but this time I am getting a different exception.
 
.NET Framework
 
As you can see in the screenshot, it is saying that “Microsoft .NET Framework 4.7.1 Preview Developer Pack is not supported on this operating system”.
 
I went through the installation instruction and tried to update my Operating System. However, it does not work for me. I am already using the latest version of Windows 10 enterprise.
 
Then, I tried enabling developer mode and updating OS and then re-installing it again. However, still, I am getting the same issue.
 
So, it seems that Windows Insider is the only option for me through which I can install .NET Framework 4.7.1 for Visual Studio 2017.  However, if you do not want to do more experiments, then I suggest not to install it. Because it may not be stable, so it is highly recommended that please go with installation only if you want to do something with the experimental version.
 
Please go through the terms & conditions of using Windows insider and only continue if you agree. Because after getting the Windows Insider update, your machine may become unstable. Please proceed further at your own risk.
 
Follow the instructions to install Windows Insider. Please make sure that you have installed all the updates related to windows.
 
.NET Framework
 
Once installation gets completed for Windows, you can retry to install .NET Framework 4.7.1.
 
.NET Framework
 
.NET Framework
 
Now, open Visual Studio 2017 and Check if .NET Framework 4.7.1 is available for use.
 

Installing Visual Studio 2017 preview  “15.4 Preview” along with Visual Studio 2017

 
If you would like to use some new features of Visual Studio 2017 which are not yet officially announced but available for use with the preview version then you can install Visual Studio 2017 Preview version alongside Visual Studio 2017.
 
Go to the official link of “Early access to Visual Studio”.
 
.NET Framework
 
Click on the download link to download. Download and install any edition as per your choice. Right now I am going to download the enterprise edition and install it.
 
It opens similar installation windows like that of Visual Studio 2017.
 
.NET Framework
 
You can see in the following screenshot that it is showing 2 different versions of Visual Studio 2017 being installed side by side.
 
.NET Framework
 
Using different versions of C# with Visual Studio 2017
 
As I have already installed all the latest components of Visual Studio 2017 I do not need to install any other component for using the latest version of C#.
 
Step 1
 
Open Visual Studio 2017 and create a console application
 
Step 2
 
Right-click on the project which you have created as a console app and open the properties window.
 
Step 3
 
Go to the Build tab
 
Step 4
 
Click on the “Advanced…” button. It opens “Advanced Build Settings” where you find options for all the available versions of C#.
 
For detailed step-by-step instructions along with pictorial representation you can go through my other article:
.NET Framework
 
If we talk about C# 7, there are 4 different options which we can choose.
  • C# 7.0
  • C# 7.1
  • C # latest major version (default) and
  • C# latest minor version (latest)
If you are looking for the option to use C# 7 & C# 7.1 with Visual Studio Code Editor, then please go through the below-provided links.
You can visit my other articles as well which are related to C# 7, .NET Core, and Visual Studio 2017.