Visual Studio - Create Class library targeting .Net Core - c#

How do I create a class library targeting .Net Core in visual studio 2015?
I found this getting started “guide”, which shows how to create a new .Net Core project using the dotnet command line tool.
Do I need to create somehow a VS project manual based on the generated files (project.json…)?
Is there a way to create a .Net Core DLL inside of VS without using the “dotnet” tool?

For .net Core RC 2 if you have installed the tools then you can simply go: File -> Visual C# -> New project -> .Net Core using visual studio. I am currently working on a guide to get started with these kind of projects here if you want so see

Related

Problem of loading new .NET CORE into Visual Studio 2017 c# .NET CORE project

I have installed both .NET CORE 3.1. and preview 5.0. I see it when I type command:
dotnet --list-sdks
I see all packages
but when I want to use it in VS project in C# .NET CORE console app I cannot.
I have not tried .NET CORE 3.x with VS 2017 but according this page it is possible that is is supported only in VS 2019.
You might also try to restart Visual Studio. I think it loads installed frameworks only during startup.
Also check out this thread. You might find there some answers

Add a Framework to a Project in .Net Core3 in VS 2019

I have created a project in VS 2019 using the "Class Library (.NET Core)" template. Now I need to add the "Microsoft.WindowsDesktop.App" framework to the Dependencies\Frameworks "folder".
Anyone know how to do this without recreating the project from scratch?

Can i install .NET Core 2.2 SDK alongside Visual Studio 2012?

I currently have Visual Studio 2012 and I want to download .NET Core SDK (https://dotnet.microsoft.com/download/thank-you/dotnet-sdk-2.2.103-windows-x64-installer).
I don't want to use it inside the VS2012 because I know this is not possible.
My question is if I can have and use .NET Core alongside VS2012? It will be safe to install the SDK? Or it might affect the functionality of VS2012 somehow?
I can't install another VS version on my PC and I want to try .NET Core.
Yes you can, it is totally possible to install .NET Core 2.2 alongside Visual Studio 2012. You wont be able to create .NET Core 2.2 Projects using Visual Studio 2012, for this you need at least Visual Studio 2015 Update 3.3 or later.
If you're looking for an alternative, Visual Studio Code might be interesting to look at. Here is a tutorial to working with C# in VS Code and here is a simple step by step tutorial to creating a "Hello World" console app in .NET Core and VS Code

Visual Studio 2017 error: Cannot find project info for “” This can indicate a missing project reference - with Console App .NET Core 2.1

VS 15.7.5
I have a .NET Standard 2.0 class library:
It exists in its own solution but I have now added it to a different solution so that I can use it with my .NET Core 2.1 Console test runner:
However as soon as I do this I get the error. If I remove the console application then everything compiles without error.
So what am I missing here? Why can a .NET Core 2.1 Console application not find my .NET Standard 2.0 class library?
I just tried to replicate what you did and it worked for me !
My .net 2 standard
That has only one class
public class School
{
public string Name => "Mango Hill";
}
And my .net core 2.1 project
that calls the class from the library
you can see the output.
So I suggest you check the common project to see if it references any full library and then try to isolate the references.
The issue here is that for whatever reason .NET Core Console apps will fail with the error I received if the following are true:
You create the standard project within a folder under the original solution that contains it. So say you have a solution called slnStandard in the path D:\Rubbish\slnStandard.
You then add a new standard class library project Standard.Project.cproj in the path:
a) D:\Rubbish\slnStandard\Standard.Project <== Will Compile in slnStandard
b) D:\Rubbish\slnStandard\SubFolder\Standard.Project <== Will Compile in slnStandard
Create second solution slnSecond and add a solution folder called MySolutionFolder. Add Standard.Project.cproj from 1 above (both versions). slnSecond will compile
Add a MSTest .NET Core Console application to slnSecond. Then "Add Reference" > Project using what has been added in 2.
If the reference is 1b) it will NOT COMPILE. So basically you need to keep the folder structure flat. Hopefully this will be fixed moving forward.
Just try running "build" or "restore" command using Dotnet CLI 2.1 version. from command window
c:\path> dotnet restore [.net core 2.1 console].csproj
this may be required once if you switch TargetFramework using visual studio.
either from .net core 2.0 to 2.1 or vice versa
If you could build the console project from dotnet CLI command "build". and you are getting this error only in visual studio.
Please try to create solution using dotnet "sln" and "add" command to refer the projects.
This happened to me when the path was cloned from git with spaces "%20". After I removed the spaces, it built without issues in Visual Studio 2017. Interestingly, I had the same issue in JetBrains Ryder, but not the command line (dotnet build).

How to prevent Visual Studio from targeting new class library projects to .NETStandard?

I created a blank web project in Visual Studio 2017 using the .NET Framework 4.6.2. This project gets created correctly:
I go to the Solution Explorer, select the Solution and select the "Add Project" menu option:
I make sure that I select the ".NET Standard" option and add a new Class Library project to my solution:
When I select the project and view its properties, the target framework is not the 4.6.2 I specified, it's .NET Standard 1.4:
Why is Visual Studio assigning the wrong framework to new projects? Is there any way to prevent it from doing this? Are there any workarounds? Is there some way to convert an existing .NET core project into a .NET Framework project?

Categories

Resources