Visual Studio 2022 don't show target frameworks to new projects - target-framework

I started using VS 2022 this week and found that when trying to create a new project in VB only .NET 5.0 and 6.0 are available as target frameworks. How do I create a new project in VB using .NET 4.8, as it is already installed as you can see in the images (I'm from Brazil, so the images show VS in Portuguese).Actually Target Frameworks availableInstalled resourcesInstalled resources

Make sure that You are selecting the correct template, they are divided into NET and NET Framework.
For example:

Related

I cannot change the Target Framework from .NET 5.0 to .NET 4.8 for a C# .NET Framework Class Library in Visual Studio 2019

I am trying to build a .NET 4.8 Class Library that I can make COM-Visible as a support library from an Access application.
There are no prompts for the version of .NET Framework when I create the solution.
When I look at the Project Properties, the .NET Framework is set to 5.0.
Although I have the .NET Framework 4.8 installed, it does not appear in the combo-box for the Target framework. The only options are shown below.
I have also noticed that the Startup object combobox does not reflect the selected startup assembly.
Do I need to drop back to Visual Studio 2017 to create a .NET Framework 4.8 library?
Which SDK is installed?
If you only have the .net 5 SDK installed, it might suffice for making a .net core 3 app but it will not cover .net Framework.
Install the .net Framework SDK for the version you want to target.
And/or install a targeting pack if you want to target .net 4.8 and 4.7.2 for example.
(Maybe helpful: What's the difference between the .NET Framework SDK and the Targeting pack)
This happened to me because I had choosen the wrong kind of project.
I had choosen a project library for C#, Windows Linux, macOS.
By this the same thing, that one could only had .NET 5.0 and higher as Framework.
I had to create a new library project with only C# and Windows.
Than I could choose all installed .NET frameworks

Visual Studio 2019 16.18.4 : .NET 5.0 installed yet not available for projects?

I have Visual Studio 2019 updated to the latest current version of 16.18.4 (see screenshot), the .NET 5.0 is installed (see screenshot made in visual studio installer) and yet when creating new projects or then changing
target framework, the .NET 5.0 framework is not available. In the about box Visual Studio displayed .NET 4.8, not .NET 5.0.
To help anyone else who might face a moment of confusion as I did, the following allows creating a .NET Framework Windows Forms project
while the following allows targeting either .NET Core 3.1 or the newer .NET 5.0
and, as said, you can't simply set from VS a .NET Framework project to target the new .NET 5.0.

In Visual Studio 2019 how do you specify the framework for a class project to 4.5?

I'm trying to create a mod for Stardew Valley, and it says that the class frameworks should be 4.5 to match the framework that Stardew Valley targets.
When I create .net projects I can specify that, but when I am creating the class framework it only goes up to 2.1.
Am I missing something stupid here?
When you create the project you have to target a "Window desktop" template that uses the .NET Framework (not net standard or net core) and select the version from the bottom of the form.

F# .NET Standard Library Project

I have a Xamarin Forms solution, containing several F# portable class libraries.
In order to use the latest version (4.0.0) of Microsoft.Azure.MobileClient, I need to upgrade to FSharp.Core 4.2.1, but this appears to be incompatible with Profile 78:
Could not install package 'FSharp.Core 4.2.1'. You are trying to
install this package into a project that targets
'.NETPortable,Version=v4.5,Profile=Profile78', but the package does
not contain any assembly references or content files that are
compatible with that framework. For more information, contact the
package author.
It is possible to use .NET Standard class libraries from Xamarin projects, but is it possible to create a .NET Standard class library in F#?
What is the best way forward here?
What the error message is telling you is that the project is targeting a PCL target. FSharp.Core 4.2.x does not have a PCL target anymore, and only contains .NET Framework and .NET Standard 1.6 binaries. Neither is compatible with the PCL target F# is using here.
The release notes for FSharp.Core were recently updated with developer guidance: https://www.nuget.org/packages/FSharp.Core/
This is the important bit for your project:
For existing packages targeting .NET Frameworks 4.0 or lower and PCLs, use FSharp.Core 4.1 or lower.
.NET Standard (as of this time) has not proliferated across all things .NET yet. As #Foole says, you can indeed create a .NET Standard class library with F# today. But it's not compatible with the rest of the .NET ecosystem until .NET Standard is fully supported on all flavors of .NET.
You can try to convert your Xamarin.Forms (and your F#) project from .NET Portable to .NET Standard 2.0, since both packages can be added to .NET Standard.
How to convert Xamarin.Forms to .NET Standard
Create new Xamarin.Forms project (skip for already created project)
Create new .NET Standard library project in the same solution
Add reference to Xamarin.Forms package
Copy your content from Xamarin.Forms shared project to the new library project
Change all references (from Android, iOS, UWP) to point to the library project instead of the shared project
Source: Xamarin Blog

New iOS MVVMCross project - which Nuget package and/or PCL targets?

We are creating a new iOS project. I want to use the Universal API so pretty sure I need to switch to Xamarin Beta channel and pull the prerelease of MVVMCross.
However when I try and add the MVVMCross package to a fresh PCL I get
Could not install package 'MvvmCross.PortableSupport 3.5.0-beta1'. You
are trying to install this package into a project that targets
'portable-net45+sl50+Xamarin.iOS10+MonoAndroid10+MonoTouch10', but the
package does not contain any assembly references or content files that
are compatible with that framework. For more information, contact the
package author.
The error looks simple enough but those compatibility errors from NuGet are never as simple as they look
The PCL is targetting
.NET 4.5
Silverlight 5
Xamarin Android
Xamarin.iOS
Xamarin.iOS (Classic)
Which targets do I need to change so I can add the correct MVVMCross to build Universal iOS
It looks like Your challenge is supporting Silverlight 5 - sl50
All the other platforms you list will support modern PCL profiles like 78 and 259. However, Microsoft haven't built any Silverlight support for these profiles.
This dropping of the "older profiles" is why MvvmCross dropped the old WindowsPhone support - announced back in July 2013 http://slodge.blogspot.co.uk/2013/07/mvvmcross-wp7-tombstoned.html
I fixed the problem you had. I managed to fix it without hacking csproj. I couldn't deselect Silverlight 5. I selected Windows 8 target and then I was able to deselect Silverlight 5.

Resources