I am building a C# project in Jetbrains Rider. When the project is finished, I want to include it in another project by building a dll and adding the dll to the project. To generate a dll, I need to set the Output Type to Class Library.
However, this means that I cannot run the project directly. Class Libraries are not runnable; if you want that, you are supposed to make a Console Application. Every time I want to test, I have to replace the dll in the other project, then run the other project. This might not seem that bad, but the problem is that my dll is only used in some places in that project.
Also, not being able to run as a console application makes debugging a lot harder since I can't write to / read from the console.
There are probably some hacky ways to get around this - while struggling around trying to come up with a solution to my problem, I have thought of a few hacky and painful methods to get what I want. However, I am looking for a clean solution. One project, same code. Built to class library when I click build, run as console application when I click run.
The best compromise I have come up with so far is to switch between Class Library and Console Application output types whenever I want to build or run. However, this is still a hacky and painful way. It's also prone to error, and if someone else wants to work on my project, there's no way to let them know other than a big ugly warning at the beginning of the README.
There must be a better way to do this. I mean, how are you supposed to test your class library? I am willing to compromise, but there doesn't seem to be anything holding back a clean and easy solution. Right?