ASP.NET

Whether you're into test driven development (TDD) or test after development (TAD), or you're into having your code get br0xored by not testing (doh!)... unit testing is all over the development world. You're a silly-goose if you haven't heard about it. In any case, using Visual Studio's post-build event process is a nice way of making sure your tests are always executed after a build. Though this isn't news to most developer 'dudes,' it surely made me all hot and steamy when I did it!
To do it you'll need the following:
- Visual Studio (no duh)
- Some sort of command line unit test app... like nunit console
- A new pair of pants after you see how rad this is.
So, you go here:
Visual Studio -> Project Properties -> Build Events
And add this line, pointing nunit-console to the DLL of your project:
"C:\Program Files\nunit\nunit-console.exe" "C:\SVN\Proj\trunk\ProjTestProj\bin\Release\ProjTestProj.dll"
And that's it! Get ready for the hotness!
But wait! There's more!
As an added bonus... I add this line before the line above...
copy /Y "$(ProjectDir)Web.config" "C:\SVN\Proj\trunk\ProjTestProj\App.config"
This enables "Unit testing" (or more like expectation testing) of the Web.config file by copying it over to the Unit Test project as App.config. When this happens, you would be able to talk to it in your Test project via the ConfigurationManager. For example:
Assert.AreEqual("666", ConfigurationManager.AppSettings["SomeImportantNumber"]);
Heavy Metal Rock and Roll.

Tired of seeing 10,343 error emails when your application blows up? So you finally took a hint and got around to logging your web application. Good work, you're another step closer to being a rock and roll geek dude.
Log4Net is a great choice for all of your logging needs. I'll assume that you have log4net correctly installed and it's giving you some sort of output. If not, the mighty Phil Haack has written about configuring log4net numerous times. 
I have two Log4Net xml config files that I switch between using debug and release preprocessor directives (Too lazy to change one for releases [They're virtually the same except for priority value]). Having the log4net config outside of web.config won't make the app restart if you need to make a change to it while it's in the wild (hot) (though won't show updates until app restart).
There are a bunch of log4net example configs available for download on the Log4Net website. I have included here the log4net config file that I am using on my latest project.
The Reasons:
Here is why I like the following log4net setup:
- The current log keeps its static name of "log-file.txt." Paired with something like Log4Net Viewer or baretail (my preference) and the scrolling appender option, it is WICKED easy to watch the logging action as it happens in real time.
- It will create a new log for each day or if the max size is reached (I have it set to 15mb here and 14 logs).
- Logs are named in such a way that viewing past logs is easy... log-file.txtYYYYMMDD is what I have here where YYYYMMDD will be replaced by the actual year, month, day. (In the case where you have might have multiple logs per day, a number will be appended to the file name log-file.txtYYYYMMDD.1, log-file.txtYYYYMMDD.2, etc.).
- What is sexier than logging?
On to the goodies...
The Config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
</configSections>
<log4net>
<root>
<priority value="Info"/>
<appender-ref ref="RollingFileAppender"/>
</root>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="C:\\Path\\To\\Your\\log-file.txt" />
<appendToFile value="true" />
<rollingStyle value="Composite" />
<maxSizeRollBackups value="14" />
<maximumFileSize value="15000KB" />
<datePattern value="yyyyMMdd" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="{%level}%date{MM/dd HH:mm:ss} - %message%newline"/>
</layout>
</appender>
</log4net>
</configuration>
The End:
In closing, I hope you have some sort of logging strategy for your application, using my log4net config or not, it will lead you even closer to being rocktaclar, and that is veddie nice.
I like the log! Niiiiice.

So you love your multi-keyed keyboard shortcuts in Visual Studio, well I do too. The best part about them is the message that pops up after you eff it up! "(Ctrl+K) was pressed. Waiting for second key of chord." Key of chord? Am I getting ready to modulate?














