Dears, I don't see the option for targeting netcoreapp when I want to create a new project. I've already installed framework and sdk but I still don't see it in the list. Please check screenshot attached.
What should I do else to be able to target net core framework?
UPDATE:
Actually, I need to retarget Unit test project to netcoreapp1.1. How can I do this? I don't see netcoreapp option in the project properties "Target Framework" list.
You don't need to be concerned by this option. Go to the template ".Net Core" and choose the template that you are interested for.
The target option will be define in the project.json (if your are using .net core 1.0 in project.json or .csproj if version >).
But, have a look on the official documentation to have a better picture of it https://learn.microsoft.com/en-us/dotnet/core/
Related
I can create .NET Framework and .NET Core but there is no option to create .NET library which is supposed to be the new .NET 5.0
I have seen the I can't create console application with .NET 5.0 as well (option missing) but I can create WPF application with that.
I want to create .NET library so to be able to use with WPF project and ASP project created with .NET 5.0 as well, so why is that option not there? I don't need it terribly in console but it would be nice to so I can test/access the library there as well.
My visual studio is up to date with everything.
First, we need to check your .net version
please check your dotnet SDKs by command below (in git bash or Windows cmd)
dotnet --info
for example, this is my dotnet SDKs
If you had no problems with SDKs check your Visual Studio for support .net5
whatever you can change the Target Framework version OR the c# Lang Version
manually in .csproj file
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>9.0</LangVersion>
</PropertyGroup>
OR
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>
For the sake of completion. I found a better way how to accomplish that and I answered the linked question with my solution here.
Essentially you just create .NET Core library and then change the version to .NET 5. See complete answer with screenshot in the linked proved above.
Step 1
Open Visual Studio Installer and make sure following are installed:
ASP.NET and Web Development
.NET desktop development
.NET Core cross-platform development
Step 2
Open Visual Studio 2019
Go to File Menu --> New --> Project
In Create New Project Window make sure all the filters are clear in the right pane
In Create New Project Window enter "library" in the "Search for templates" box at the top and hit enter to display library project type templates below
Step 3
After creating class Library Project follow instructions in following post to change type of class library project to target .NET 5.0
How to create .Net 5.0 Class Library project in Visual Studio 2019 16.8.1?
I have a solution in C# in Visual Studios. It was first created in .NET Framework. I want to convert the project to .NET Standard/Core. If I go into project --> properties I see the attached screen, where Target Framework is .NET Framework. How am I able to change that to .NET Standard/Core?
As Roman Ryzhiy mentions in the comments, this is the way to go:
https://learn.microsoft.com/en-us/dotnet/core/porting/
This worked fine for me, I upgraded a .NET Framework 4.7.2 projekt. It was a small project, so I had few aftermath-problems. After the upgrade, the Target Framework in the Application tab will say ".NET 5.0".
Install upgrade-assistant:
dotnet tool install -g upgrade-assistant
Go to your solution folder
Run the assistant:
upgrade-assistant upgrade your-project-name.csproj
Follow the steps in the assistant, it's really straight-forward.
Also, here are the steps more detailed:
https://learn.microsoft.com/en-us/dotnet/core/porting/upgrade-assistant-overview#installation-steps
I don't understand why I'm getting this error after downloading the frameworks 4.7.1 and 4.7.2 developer packs VS Frameworks
It even gives me the option to start a new project with these frameworks, so I do not understand??
Error
Frameworks
Version
The error says you are targeting version 4.7. Your other screen captures show that you have versions 4.7.1 and 4.7.2 installed. Try changing your version 4.7 reference to version 4.7.1 or 4.7.2.
This is normally done with the dropdown show in your Frameworks link. If that isn't working, you can manually check the project file. Right-click the project in Solution Explorer and choose Unload Project. Right-click the project again and choose Edit myproject.csproj. Near the top, you should see a line like this:
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
If that just says 4.7, then update it. Save and close the .csproj file. Right-click the project again, and choose Reload Project
I'm trying to select target framework from the solution explorer, however all I can see is ".NET Standard 1.0" to 2.0 as available target. I've updated VS to the latest version (15.7.4) and have selected ".NET Desktop Development" workload in the installer. .NET 4-4.6 dev tools also already installed. So why can't I select them?
You've created a ".NET Standard" project and those are the only currently existing versions of the .NET Standard.
It sounds like what you want to create is a "standard" .NET project which is any of the options found under Windows Desktop in the New Project dialog (though none are by that name). This will give you the option of selecting which version of the .NET Framework you want to code against:
I just create a simple ClassLibrary project with VS2017 preview 2.1.
I create using .NET Core project template. When I check in project details, I see it targets .NET standard 2.0. How I may target .NET Core 2.0 (that implement a larger number of API according to a test made with API-Port tool)
Update: The templates have been fixed in a recent update to VS 2017 15.3 Preview.
This really looks like an issue with the templates, I also created a project from the "Class Library (.NET Core)" template and it targeted .NET Standard 2.0.
However, this can easily be fixed by editing the csproj file manually from
<TargetFramework>netstandard2.0</TargetFramework>
to
<TargetFramework>netcoreapp2.0</TargetFramework>
This project type allows editing the csproj file while the project is loaded by right-clicking on the project and selecting "Edit {project}.csproj".
It looks you may create a .NET Core app with VS2017 targeting .NET Core 2.0, but as soon you create a .NET Core project library, it targets .NET standard, it might be a limitation of this preview of VS2017.
The issue is gone with VS2017 15.3.0 Preview 3!
I'm on Visual Studio 2017: Community.
I installed the SDK found here: https://www.microsoft.com/net/download/thank-you/dotnet-sdk-2.1.3-windows-x64-installer
You should be able to see the NET Core 2.0 as the target framework when creating your project.