Alright, I’ve fought with these kinds of things since the inception of .NET, the key difference now is that there are the variances in .NET versions and also IDEs. The question is, how should I setup my solution and respective projects?
First – .NET Solution
Usually what I do is create an empty solution. Name it, check the options accordingly to create a directory and make it a Git repository.

Then, as a kind of general practice I create a class library to build out logic and what not, and add a test project and then whatever the interface is going to be. That might be a web app, a GUI, or console as I’ve got selected here. Sometimes, if useful I go ahead and create a Dockerfile.

At this point, there are a few key problems I always bump into. Obviously, since I have a repo I need a .gitignore file, preferably a README.md, and maybe even a license file right? How does one add, so that the IDE is aware of them, any extra files at the solution level? What I usually do here, is use the terminal to just build out the solution level files, but then the IDE doesn’t know about them. Similar problems come up in the other .NET IDEs like Visual Studio and such.

Second – Open a Folder Solution
The second type of solution I find myself creating is started by opening a repo folder.

Empty, with nothing else that looks like this.

Creating a .gitignore and other respective files is easy at this point. As a right click will allow me to do just that. I’ve also added some projects.

At this point everything works great. As you can see below the runner is wired up, the IDE is aware of the tests, and runners are available for that.

One problem I’ve run into however with this technique, is sometimes I close this type of project – one started by merely opening the folder – and all this awareness just disappears. On the same machine, same folder, no deletion of the .idea folder or anything like that. It just loses all the awareness.
So my question is, which method do you use to start a project and how to do you, fellow .NET coders, work around these types of issues?

You must be logged in to post a comment.