I just installed the .NET 5 SDK, and created a new C# library.
The .NET 5 is missing from available frameworks. I've tried both standard, core and .net version of the library template.
As this was newly released, I can't find any hints on what I am missing with the good 'ole google search.
I was using VS2019 version 16.7.7, but 16.8 or later is required for .NET 5.0.
My bad. Should've checked the requirements before creating this question. Sorry
Related
Trying to use sample code from the book "Learn C# programming..." by Bancila and Sharma.
When I try to build the project, I get error messages saying that certain features are not available in C# 7.3, and that I should upgrade to C# 9.0 resp. 10.0.
However, there is no way to change the language version. When I go to Project Properties/Build/Advanced, the language version shows frozen. Also, adding the line "<LangVersion>10.0</LangVersion>" in the .csprog file seems to have no effect.
Can somebody help or at least explain?
Thanks!
I added the line "<LangVersion>10.0</LangVersion>" in the .csprog file. But the problem remains.
The C# version depends on the .NET / .NET Framework version you are using.
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/configure-language-version
You'll need to download the relevant SDk to have access to newer versions of C#.
For C# 9, you need the .NET 5 SDK.
You can find it here:
https://dotnet.microsoft.com/en-us/download/dotnet
The book is targeted for C# 8 i.e. net core 3, so I would recommend just creating a project for .Net 6 or 7. These should be fully backward compatible with .net Core 3. In the visual studio installer you can select what specific .Net versions you want to include support for. I would expect .Net 6 to be installed by default, but it is easy to check.
I am trying to add the Cef.WinForms library to my project and I'm following the steps found here
https://tutorialslink.com/Articles/DEVELOPING-CHROMIUM-BASED-BROWSER-IN-Csharp/1468. I was able to add the library find using Nuget, however I did get a warning that it expected .NET 4.6.1 and I have .NET 5.0. I tried to manually install 4.6.1 but it will not allow it as it says a newer version is already installed. This may not even be the cause of my error but I wanted to mention it just in case.
When I try to drag the component ChromiumWebBrowser over to my main form, I get the error seen below. I've searched for this error to try and resolve it but I am so far not finding anything helpful. Does anyone know what I'm missing here?
As noted in the comments, when targeting .Net 5.0 you'll need to use the packages with the NETCore suffix.
For .Net Core 3.1/.Net 5.0+
https://www.nuget.org/packages/CefSharp.WinForms.NETCore/
https://www.nuget.org/packages/CefSharp.Wpf.NETCore/
https://www.nuget.org/packages/CefSharp.OffScreen.NETCore/
NOTE A minimum of .Net Core 3.1 is required.
For the .Net 4.5.2 to .Net 4.8
https://www.nuget.org/packages/CefSharp.WinForms/
https://www.nuget.org/packages/CefSharp.Wpf/
https://www.nuget.org/packages/CefSharp.OffScreen/
All packages require Microsoft Visual C++ 2019 or greater.
Ijwhost.dll
To support C++/CLI libraries in .NET Core/.Net 5+, ijwhost was created by Microsoft as a shim for finding and loading the runtime. All C++/CLI libraries are linked to this shim, such that ijwhost.dll is found/loaded when the C++/CLI library is loaded. It's important this dll is distributed with your application.
Upgrading VS 16.7 to 16.8 made .NET 5 unavailable...
( worked in previous 16.8.0 preview 3)
.net 5 is installed...
but when creating a new project in Visual Studio
is not appearing in the target frameworks list...
dotnet --info
states .net 5.0 it is installed:
Microsoft.NETCore.App 5.0.0 [c:\Program
Files\dotnet\shared\Microsoft.NETCore.App]
and
csc -langversion:?
reveals C# 9.0 is the default language
Installing de SDK separatly did not solve the problem.
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
I have also updated to 16.8.0, but when I create WinForm or WPF it automatically Targets 3.1 and I have to manually update it to 5.0.
I found that in Options->Environment->Preview Features if I tick "Use previews of the .NET Code SDK" when I create a project it does give me the option of the Target Platform.
The .NET 5.0 option is listed but says ".NET 5.0 (Preview)" even though it should be the GA release.
It seems like Visual Studio thinks .NET 5.0 is in preview and not offering it as an option unless the above is ticked.
By the way I have never installed any previews on this machine.
Ok PPL... chill out!!! problem solved!
Just now (2020.11.12 21.50h UTC)
VisualStudio notified me of an available update: Version 16.8.1...
(yes,,, 1 day was the lifetime of previous version 16.8.0 ;-))
After install .net 5.0 now appears correctly as a target platform...
Just some more of the usual MS annoyances...
It's solved!
Thanks to everybody who tried to help!!!
Solution found! Took awhile, installed ALL sdks, and ALL runtimes then reinstalled latest version I wanted!
Goal,
Have netcore 2.1 or greater as a dropdown option in visual studio. I've looked at possible duplicates questions already!
Details
After the last update of visual studio 15.7 to 15.8.4 .net core 2.1 or greater has disappeared from the target framework list.
I looked at other solutions as seen below. They were not helpful as I installed every version under the sun. See below screens.
Checked below for solutions (I already looked for solutions here!):
VS2017 : Target framework drop down does not show .NET Core 2.1 option
The current .NET SDK does not support targeting .NET Core 2.1. target .NET Core 2.0 or lower or use a vs of the .NET SDK that support NET Core 2.1
Referenced screens:
UPDATE1: Removed 2.2 preview (NOT SOLVED, 2.1 is still missing)
In general, when new preview version of .NET Core 2.X appears and you are getting the error like this:
The current .NET SDK does not support targeting .NET Core 2.X
Make sure that:
You have downloaded installed SDK and runtime you need. Run command dotnet --info to see what you have installed on your machine at the moment.
You have checked the Use previews of the .NET Core SDK option here:
-> Tools -> Options -> Projects and Solutions -> .NET Core
Sometimes you might need to restart your Visual Studio after checking the option.
Note: it's always better to have the most recent Visual Studio version installed on your development machine (sometimes you might need a preview version - note a Download Preview link).
The user said, that my comment fixed the issue. So I'll post it as answer:
On the picture I see a lot of installed .Net Core SDKs, maybe Visual Studio has some issues with so many installed SDKs.
So move all old SDK folders (1.0 preview, 2.0, 2.1 except 2.1.402) out of this folder to a backup location and launch Visual Studio again.
I had this issue as well, this is what I did and it worked for me, It may or may not for you. I uninstalled everything after 2.0. I then went to this link https://www.microsoft.com/net/download and downloaded both the SDK and Run-time downloads for 2.1 then after installing them I restarted my laptop and booted up VS2017. I then went and tried creating a new web app MVC and selected .netcore 2.1 it was there.
However keep in mind .netcore 2.1 is not yet available for every template you have so check web app MVC template first if its there then you have 2.1 it just may not be available for a specific template you might be trying to use it for yet.
Hope this helps
In my case solution was: i removed few .NET Core SDK:s from "Add remove programs" and restarted visual studio. Than SDK that i need was in the list
So i'm doing this project for my Computer Programming Class (That's due tomorrow) and i'm basically done with everything. Our school has Visual Studio 2010, and I have Visual Studio 2017. However, when I open it, it asks me to change to ".NET Framework 4.6.1" as my computer doesn't have ".Net Framework =v4.0". When I do, I can edit the program, but I can't debug/compile the program, as it outputs this error:
The reference assemblies for framework ".NETFramework,Version=v4.6.1" were not found. To resolve this, instal the SDK or Targeting Pack for this framework version... Therefore your assembly may not be correctly trageted for the framework you intend.
However, when I tried to go online and install the v4.6.1, the installer said that I had already had a version of 4.6.1 or a more updated version on my computer. I don't understand why this is, and if there's another question like this it would be helpful if you could link it as a reply. Thanks.
The answer to your problem is directly in the error message. "To resolve this, instal the SDK or Targeting Pack for this framework version."
My advice: Download and install .NET 4.0 SDK on your computer.
You can try one of these links to get the SDK:
https://www.microsoft.com/en-us/download/details.aspx?id=8279
https://www.microsoft.com/en-us/download/details.aspx?id=8442
You can also try the multi-targeting pack.
https://www.microsoft.com/en-us/download/details.aspx?id=29052
Also, checkout:
You can use the setup verification tool to diagnose your .Net Framework here: .Net Framework Setup Verification Tool or Alternative Download.
Also check the .NET Framework Setup Verification Tool User’s Guide
If you do find problems with your .Net Framework, you can use the Repair Tool to fix it, it is designed to fix issues specifically concerning the .Net Framework as well as updates: Microsoft .NET Framework Repair Tool
Hope this will be useful, good luck.
For VS2017 to support .NET 4.0, you need to make sure you've installed the correct component: