Setting Default .NET Framework in Visual Studio 2017 - visual-studio

I'm running VS 2017 v15.4.4.
When I create a new project VS always defaults to using Framework v4.6.1, even though I have version 4.7 installed. I always have to manually change to version 4.7.
Is there any way to make VS always select version 4.7 for new projects (or even better yet, always use the most recent version of the .NET Framework available on my machine)?

Related

Setup project visual studio 2022

What can be the reason that install is greyed out?
Microsoft Istaller projects 2022 is installed. Solution can build without problems.
It's an old project where .net Framework 4.0 is used.
I'm just guessing, but it might be that .NET Framework 4.0 is deprecated and support was removed. You can't even install it via the Visual Studio Installer's Individual Components. The lowest 4.x targeting pack version I could install is 4.6.
Try installing the latest .NET Framework targeting pack and then re-target the project to use that.

.NET 5 not available in Visual Studio 2019

I have downloaded and installed .NET Core 5.0 SDK (v5.0.100-preview.1) in my Visual Studio 2019.
But it is not available in Target framework.
Am I missing something?
You need to install the latest preview of Visual Studio 2019 16.8, refer to
https://devblogs.microsoft.com/aspnet/asp-net-core-updates-in-net-5-preview-1/
You also need to explicitly enable preview versions within Visual Studio itself:
Then you should see it:
Specs: VS Version 16.8.0
Target Version of .Net Core: 5.0
You must have version 16.8.0 in order to have .Net Core 5.0
If you still have problems with Visual Studio not showing .Net Core 5.0 in Visual Studio version 16.8.0 (and assuming you downloaded the .NET Core 5.0 SDK for Visual Studio), well, apparently (and correct me if I'm wrong) it is now called just .Net 5.0, omitting the Core.
After selecting .NET 5.0, I was able to install other libraries which are currently version 5.0+ and dependent on .NET Core 5.0+
Is the new name intentional? Anyways, here some evidence of this working (I was able to install the newest version of Newtonsoft and Entity Framework for .Net Core):
Funny enough, when I try to create a new .Net Core project, the version shows up as expected:
I upgraded my version of Visual studio from 16.7.x to 16.8.1. I expected NET 5 to be listed as a target framework, but it was not.
I had previously created projects in 16.8 preview 6 using RC1.
Visual Studio Install did not list .NET 5 as an individual component either. I then downloaded and installed the x64 SDK. Still no luck. .NET5 was still missing as a target framework for VS 16.8.x
Today I opened VS Installer and from the More dropdown menu selected Repair . The repair process took 25-30 minutes to run, but now .NET Core 3.1 and .NET 5 are listed in all the usual places.
Norm
Maybe a bit late to the party.
Please note that if you've selected a 'regular' .NET Framework application you won't see the .NET 5.0 Framework option.
This is only visible in .NET Core project styles.
Try to set it in your .csproj file. Right click (maybe unload) and edit (within a PropertyGroup-element):
<TargetFramework>net5.0</TargetFramework>
Targeting .NET 5 (rc2) doesn't work smoothly in VS Version 16.8.0 Preview 6.0
I could only target .NET 5 by manually changing the .csproj file, and adding:
<TargetFramework>net5.0</TargetFramework>
When I wanted to create a solution, .NET 5 was not available, even when I have it installed. What I did to fix this was:
When you are creating the project, select the last version (in my case .NET Core 3.1)
When the project is created, right click on the project and select the Properties option.
In the Application tab, select the Target Framework you want.

Why isn't .NET Core 3.1 showing up in Visual Studio after Iinstalled it?

Just installed .NET Core version 3.1.
I'm using Visual Studio 2019, version 16.4.2, so it should be compatible.
But when I try to "create a new project" nothing Core-related shows up in the list, no matter how many ways I try to query.
I'm told it should show up but it doesn't. Haven't a clue as to why (I assume I've missed a step along the way).
VS 2019 16.4.x will always have .NET Core 3.1 as its main target by default, and VS 2019 16.4.0 or later will always install .NET Core 3.1.100 SDK if you select .NET Core workload when you install VS 2019.
If it's not shown when creating new project, then you have to ensure that you have selected the .NET Core workload when you install VS 2019:
Eriawan's answer pointed me in the right direction. The problem was, as suspected, very simple. I had bypassed Core when first installing VS 2019. Just had to use the Installer and install to fix.

NET Framework Version compatibility for Visual Studio Package

I have a visual studio package which currently targets .NET Framework version 4.5 and works with Visual Studio versions from 2012 up to 2019.
If I upgrade to .NET Framework 4.7.2, what does this mean for compatibility with different versions of Visual Studio?
Will it automatically make the package incompatible with older versions of Visual Studio (e.g. 2012, 2013 and 2015)?
if you install a specific version of .net framework you can see that in your target framework.
you can use this address to see all the .net SDK for visual studio
https://dotnet.microsoft.com/download/visual-studio-sdks?utm_source=getdotnetsdk&utm_medium=referral
you must attention, if you want to using .NetCore in your project you must have a newer version of Visual Studio like 2017 or 2019.
An answer for those who doesn't need compatibility deeper than 2017
(But still ended up here from a search engine.)
Check system requirements.
For example, Visual Studio 2017 Product Family System Requirements says that:
Visual Studio requires .NET Framework 4.7.2 to run, and this will be
installed during setup.
This means that we can be 100% sure that it's safe to target 4.7.2 when targeting VS 2017.
P.S.: The reason I limit backward compatibility to 2017 is I don't see any mentions of .NET framework in the system requirements of older versions, so this method won't help with targeting older versions.

.Net Core 2.1 templates missing from VS2017

I have VS2017 (15.5.4) Professional already installed and today I installed .Net Core SDK 2.1.4 but I cannot see any Core templates in the New Project dialog in VS.
If I run dotnet --version in Powershell, it correctly shows me 2.1.4 installed
I have removed all Core installations on my windows 10 machine, reinstalled 2.1.4, run the repair on VS and also tried devenv /installvstemplates but nothing seems to work.
Can anyone help please?
For .NET Core 2.1, you need Visual Studio version 15.7 or higher. (check it from Help menu > About Microsoft Visual Studio). So, first ensure you have update your visual studio.
Now, to add .NET Core 2.1 (or other newer templates) to visual studio, you need to install the Latest .Net Core SDK from here.
For any templates: Make sure VS has the necessary components, make sure that the cross platform development workload is installed through the Visual Studio Installer.
The SDK 2.1.* only contains the 2.0.* runtimes. At the time of writing, there has been no public preview release for .NET Core 2.1.
You can download 2.2.0 SDK previews from https://github.com/dotnet/cli.
Note that the naming may change in the near future in order to avoid confusion and keep the SDK and Runtime major and minor versions in sync - see https://github.com/dotnet/designs/pull/29.
Update Visual Studio to version 15.6.0.

Resources