So Far
In the last post, I walked through the steps to create the folder structure and checking it into my Unfuddle repository. Now we will pick up from there and create our Solution file, MVC/Test projects, verify it builds, and check that into the Unfuddle repository as well.
A few prerequisites
- Visual Studio 2008 – SP1
- ASP.NET MVC Beta
- XUnit – with the Visual Studio plugin installed (you could do this with MS Test as well)
Creating the Solution File
When creating a new solution I lean toward setting it up first using a Blank Solution so that I have a little more control over the process. You can just let it create it automatically when you create the MVC Project but you don’t get as much control over the folder structure within your project and may need to go back and manually move things anyway. I just do it as I go.
Open Visual Studio and click on File –> New –> Project
Once it opens select Visual Studio Solutions under Project Types.
Then select Blank Solution, enter the solution name, enter the path in your local repository coresponding to trunk\src and click OK.
Now this what gets created:
You will notice that the sln file was created in a new mymvcsolution folder which I really don’t want. I will just close Visual Studio, cut the files and paste them into the src folder and then delete the unwanted folder. ALl the mappings within the file are relative so once the files is moved all is good.
Create the MVC/Test Projects
Now click on the sln file to reopen Visual Studio.
Click on FIle –> New –> Project
Under Project types select Visual C# –> Web and the ASP.NET MVC Web Application.
Enter mymvcapplication for the name, verify that it is using the trunk\src folder as the Location and for Solution it should use Add to Solution.
You should now get the following prompt:
I have selected xUnit but you could also go with MSTest at this point .
Now if you try to build at this point you will get 5 identical fails:
“The name 'GlobalApplication' does not exist in the current context C:\projects\mymvcproject\trunk\src\mymvcapplication.Tests\Routes\RouteFacts.cs”
When you navigate to the code you will find the following:
1: GlobalApplication.RegisterRoutes(routes);
The problem is that the GlobalApplication is named MvcApplication in Global.asax.cs. If you update this in each of the tests to:
1: MvcApplication.RegisterRoutes(routes);
A Little Tuning
Click Add Reference:
Click on the Browse tab an d navigate to the trunk\thirdparty, select xunit.dll and click OK.
If you build the solution now you will find it builds fine.
If you want to see success hit F5 and click ok on the warning to enable debugging in your web.config. You will see this:
Now I will close Visual Studio and Check in.
Checking In
I will now navigate to the trunk folder and right click on the mymvcproject(root) folder and right click on the trunk folder and click on SVNCommit:
I will then click the select all box but then deselect the contents of the bin folder, add a message like “Initial Project Checkin” and click OK. The following dialog will show the files being added and uploaded and the success message (hoepfully):
Now when I open Unfuddle and check the repository I see the files I checked in so we are done!
Ok well done is a strong word really we are ready to actually get started but now we have a place to work and if we check in religiously we have some backup for code changes and such.
Later I will visit how to set up a continuous integration server with CruiseControl.NET so that you can get validation that your checkins don’t break the build.
Please let me know any comments you may have.
No comments:
Post a Comment