Friday, November 8, 2013

Blank Solution (Visual Studio)

A couple weeks ago, I was reviewing a project that a friend of mine was working on and noticed that he had a solution named similar to ProductName.Web.  This solution had an Asp.Net MVC Application with the same name along with other non web type of projects.  I asked why he didn't have a main solution named ProductName with other projects under that named ProductName.Web and ProductName.Whatever.  He said he didn't know of a way to do that, so I mentioned starting off with a blank solution.  To my surprise he was unaware of how to create a blank solution.  Fast forward a week or so later where I mentioned this to a co-worker and they informed me that they didn't know either.  Knowing that some people do not know that the blank solution exists confirms my belief that nothing is too simple to write about.  There is always something that you know that others don't and always something that others know that you don't know.

To start with, I wanted to list a few benefits of creating a blank solution first and they are as follows:

1.  Better grouping.
2.  Avoid having to rename things (projects, folders, etc.) in the future.
3.  It is clean
4.  It is what the cool kids are doing these days.

Steps for creating a Blank Solution and adding projects to it

1. Open Visual Studio and select File -> New -> Project







2. Expand Templates -> Other Project Types -> Visual Studio Solutions and then add a name to the Name field. In this case, I named it Namyaf and then clicked OK.


3.  As you can see, the blank solution is created with nothing in it.  


4.  If you open Windows Explorer and go to the location of your new solution, you will see one solution file.


5.  One thing that some people don't know that I wanted to mention here is that solution files are just text files and you can view them in notepad as seen below.  This one is very basic as you can imagine, but they will get filled with other stuff as projects are added.














6.  The next step is to add a project to the solution that you just created.  To do this, right click on the solution in Visual Studio and select Add New Project.





7.  Select Asp.Net MVC 4 Web Application, type Namyaf.WEB, and then click OK..


8.  Select the Empty template and also make sure the Create a unit test project is checked because we all know TDD is the way to go.


9.  Now, when you browse to your solution folder in Windows Explorer, it is much cleaner as you can see below.


Once again, I hope you learned something and enjoyed reading and following along.

Peace Yo!


2 comments:

  1. Awesome you got a blog going. Good to see you are liking TDD as well. Are you writing any tests for actions that uses HttpContext(Query String, Session, Etc)?

    ReplyDelete
  2. Hey Joel, I still consider myself a rookie TDD adopter, but I am really trying to stick to it even though the business and deadlines are trying to get in the way of my attempt in TDD. So, to answer your question, I have not. Most of my tests are pretty basic so far and I haven't had to get into anything beyond what some TDD practitioners would consider basic.

    ReplyDelete