1

I tried to search if one can use .net core console application as a library. I know that there is .net standard for that, but I'm curious because other languages support that.

1
  • 1
    Have you tried it? Commented Jan 8, 2019 at 14:56

2 Answers 2

1

You can directly create a dll with netCore as Target

Sign up to request clarification or add additional context in comments.

1 Comment

Not an answer I was looking for but still information I can you, thank you
0

Libraries and applications are two different things.

A class library defines types and methods that are called by an application. A class library that targets the .NET Standard 2.0 allows your library to be called by any .NET implementation that supports that version of the .NET Standard.

A console application, in the context of C#, is an application that takes input and displays output at a command line console with access to three basic data streams: standard input, standard output and standard error. ... It is the simplest form of a C# program and is typically invoked from the command prompt.

I am not exactly sure what it is you are trying to achieve here. However try this lets say you have two console applications app 1 and app 2. Lets say app 2 has some objects you would like to use in app one. You could reference app two in app one and then you will have access to them.

Ideally though if you had an object that would be used by two different applications you would be creating a class library containing that object and then reference it from both applications.

Also .net core doesn't compile to an exe everything is a dll however you are dotnet run would not work on a library project.

2 Comments

TLDR: You can if it's a 3rd-party exe you can't recompile. But if it's your own application, it's considered bad form and you really should take out the common code into its own library.
.net core doesnt compile to an exe everything is a dll however you are corect dotnet run would not work on a library project.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.