DEV Community

Cover image for Poor man's dotnet solution setup
Rafal Pienkowski
Rafal Pienkowski

Posted on

Poor man's dotnet solution setup

Some time ago I started my journey into a Linux with dotnet Core.

Initially, I planned to describe how to set up a working solution, but I've found an article about this here on In my opinion. Rui covers almost all important things which I had planned to describe. If you don't know how to start ASP.NET Core Development in Linux, I encourage to read his article. Well done Rui!

Because I have nothing to add in that subject, I've decided to focus on another one. In my previous article some of you've suggested me to use Jetbrain's Rider IDE. Maybe in the future, I'll buy it, especially if I decide to switch from Windows to Linux/iOS. I think that in such case is reasonable to spend about 350$ for an IDE. For now, for my side projects, I'm going to focus on VS Code.

The thing which made me crazy was a project initialization. I fed up with continuous typing of the same command-line commands to set up a new solution. Like every developer, I'm a lazy person.


To avoid doing this boring stuff over and over again, I've decided to write a bash script which will do all that tedious staff instead of me. The source code of it could be found on my GitHub repo.

This script creates a basic solution's folder structure. It initializes main project and dedicated test project. Created test project contains the reference to the main project. It has also referenced two advantageous (at least in my opinion) NuGet packages: FluentAssertions and Moq. It creates sln file which could be beneficial for devs which plan to open the solution via full Visual Studio. In the end, Visual Studio Code will be opened.


dotnet-solution [solution-name] [main-project-name] <<template>>
Enter fullscreen mode Exit fullscreen mode

The template is passed to the [dotnet new] command. It will be used to create the new dotnet project based on it. More about templates you can be found under this link.


dotnet-solution adventure-works AdventureWorks.Common classlib
Enter fullscreen mode Exit fullscreen mode

Solution structure which will be created by the example above. I've intentionally omitted some meaningless folders.

+-- adventure-works
|   +-- src
|       +-- AdventureWorks.Common
|       |   +-- Class1.cs
|       |   +-- AdventureWorks.Common.csproj
|   +-- test
|       +-- AdventureWorks.Common.Tests
|       |   +-- UnitTest1.cs
|       |   +-- AdventureWorks.Common.Tests.csproj
+-- adventure-works.sln
Enter fullscreen mode Exit fullscreen mode

For those who are not familiar with Linux/Unix systems, to add a specific extension to your bash shell you need:

  • download it to your machine
  • copy to /usr/bin catalog (admin rights will be required)
  • make it executable by chmod command (admin rights will be required)
    chmod +x dotnet-solution
Enter fullscreen mode Exit fullscreen mode

Feel free to copy, use and modify those scripts. I'm also open to all your suggestions and propositions. Please keep in mind that was my first steps in bash scripting. I hope it can be handy for you.

Top comments (3)

bgadrian profile image
Adrian B.G.

I think the answer is "Java with Intellij community edition"?

Just saying ... don't stick to one technology/language just because is more familiar, if other one is more suited for the task go for it. Using without the power of Visual Studio seems a bit stretchy.

PS: I hate C# as much as Java so I'm unbiased.

pim profile image

I second this. All of my exploits using .NET outside of Visual Studio on Windows have felt second rate. This isn't a knock toward the platform, it's amazing. I simply think that the tooling just isn't quite there yet. But still exists in a pinch.

rafalpienkowski profile image
Rafal Pienkowski

Hi Adrian.
Thanks for your comment. I see your point of view. I also think that we, as developers, should always use tool dedicated to the goal we want to achieve.

My goal for the whole series of post about how to be a .Net dev in Linux world is to find out how I, as .Net dev will feel in a new environment. I'm not going to switch to the Ubuntu as my primary OS. At least for now πŸ˜‰