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.
Related
I created my initial project that targets Framework version v4.7.2. I needed to add a class library in my project using visual studio 2022 Community. While doing so, VS2022 gave me only 4 options to choose from for setting Target Framework (.Net Standard 2.0, .Net Standard 1.0, .Net 5.0, .Net 6.0). This feature isn't there in VS2019 Community. I selected .NET 5.0
Now this class library cannot be referenced by my initial project. I think I need to update .NET Core SDK but don't know which version (if I am correct in my assumption).
Please help. Thanks
You should add a class library, which is supported .NET Framework.
In the one project, all classes are the same target output (.NET Core or .NET Framework)
Referred project and reference project are the same target output.
My case:
I created Winform Application(.NET Core), then add Junit Project(.NET Framework) referring to Winform Application and they are conflict due to different target.
My Solution:
I changed Winform Application from .NET Core to .NET Framework and they are working.
Hope to help you!!!
I have ASP.NET Core 3.1 project with React and Redux in VS Profession 2019 and use included SubProject Library with .NET Standard 2.1 in Solution.
After the release of .NET 5, I change via Project => Properties => Application:
Library from .NET Standard 2.0 to .NET Standard 2.1
ASP MVC Core from .NET Core 3.1 to .NET 5
The application works perfectly, but if I want to edit Controller, where I include a dependency to Libraries from other projects I see Interface with the red color name:
I am not sure where is the problem, and why VS does not find a reference to the libraries.
Because program works, I have added references, but only VS do not see this
Intellisense sometimes misbehaves. You can
Close VS (do not skip this step)
Delete all 'bin' and 'obj' folders for all your projects.
Re-open VS and do a clean re-build on the solution.
This will either expose issues you may have missed or fix the red underlining.
Easy Solution
Change in each .NET Standard library *.csproj from:
<TargetFramework>netstandard2.1</TargetFramework>
to:
<TargetFramework>net5.0</TargetFramework>
Update Nuget packages
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 seem to have lost the ability to create an ASP.Net Core Web Application that targets the .Net Framework. The dropdown is disabled where it used to be enabled.
I have .Net 471, 472 SDKs and targeting packs installed and my VS2017 is updated to 15.7.6.
I've tried uninstalling/reinstalling the .Net 4.7x SDKs and targeting packs but that didn't help.
Is there something short of reinstalling Visual Studio from scratch that I can do?
The project template only supports .NET Core. However, once you create the project, you can edit your .csproj and change:
<TargetFramework>netcoreapp2.1</TargetFramework>
To:
<TargetFramework>net472</TargetFramework>
Save, and you're good to go.
It would appear that there are two templates now that can create an ASP.Net Core Web Application.
Under .Net Core
And under Web
To get the option of selecting to target .Net Core or .Net Framework, you must use the template under Web.
I have a .NET Core (ASP.NET Core) project created using Visual Studio 2017 RC (MSBuild).
I also have an old F# project library (traditional .NET Framework Library) that compiles to a dll file. I want to use it in said ASP.NET Core project.
To do that, I added a project reference in the ASP.NET Core project, opened the namespace, and made a few function calls in my controllers; it works perfectly when running the ASP.NET Core server using ISS from VS.
My question is, will this arrangement work if I want to deploy to linux (Ubuntu)? Or does using external PCLs/dlls from .NET Core instantly make it windows-only?
Note that I didn't have to add .NET Framework as a target framework in my csproj (it's MSBuild Core), it just worked.
Since your F# project targets the .NET Framework it will not run cross platform. If you modify your F# project to target the .NET Standard library it will. Here is a video by Immo Landwerth explaining how the .NET Standard Library works.
You should be able to just to reference the .NET standard library and not have to change anything. However the current version, which is 1.6, is missing a lot of API's from .NET Framework. This is fixed in 2.0. Infact since your using .NET Core 1.1 I think you are already using 2.0, but I'm not certain. Here is another video by Immo explaining how it should work.
That being said, I'm not sure what the F# support is like with .NET Standard.