Creating a NuGet package
27 Mar 2014

nuget c# .net guard


Download NuGet Download the NuGet command line utility. http://nuget.codeplex.com/releases Once downloaded place the executable (NuGet.exe) in an easily assessable location e.g. C:\NuGet\NuGet.exe Add the location to your system path in order to make the NuGet.exe globally accessible from the command line. It’s not strictly necessary but will save you having to type the full path of the exe every time you want to use it from the command line. You can find out how to add a location to your computer's system path here: http://answers.yahoo.com/question/index?qid=20090723044645AAG0QrI Create...

Read More

Reading Settings from App Config
10 Feb 2014

.net c# configuration dictionaryadapter


The ability to change the behaviour and configuration of your application without making functional code changes is very important. One of the most common ways of achieving this is to place configurable values and settings into your project’s app.config file. The aim of the game is to make use of these settings throughout your application. These settings may be of varying types: strings, integers or dates. In order to make these accessible you will need to read these settings from the project’s app.config file and parse the values where necessary. So, for example, you would expect to see code...

Read More

Creating a Centralized NuGet Packages Folder
12 May 2012

msbuild nuget visual studio 2010


I would imagine most people by now will have discovered and use the NuGet Visual Studio extension (http://www.nuget.org). It is a great way of adding and maintaining 3rd party code libraries in your projects. One problem I find though is that every time I create a new project or solution I end up installing the same old NuGet packages. By default NuGet downloads the source code for these packages into a new "packages" folder in your project/solution root directory. This means I have the same source code downloaded multiple times, in multiple locations. This can easily be fixed as you can...

Read More

Style Selected Text with CSS3
16 Jan 2012

css css3 html selection


Loving some of the new things you can now do with CSS3. Recently discovered that you can add styling to text selected by the user. Begs the question where you could make use of this or in fact whether a user is ever likely to notice you have tweaked the styling for their benefit but hey... Style Selected Text Simply drag the cursor over the styled text and the background and color properties change. This is now supported in the latest versions of all the major browsers: Internet Explorer, Opera, Firefox and Chrome.

Read More

Using Log4Net in a Shared Hosting Environment
26 Sep 2011

.net adonetappender log4net medium trust mvc


Another day and another shared web hosting issue. This time it's with Log4Net and its AdoNetAppender. The AdoNetAppender is used by Log4Net to append logging events to a table within a database. This is my preferred method for logging any live site errors within my web applications. However the latest release of Log4Net (1.2.10) will not allow the use of the AdoNetAppender within a medium trust environment. Fortunately after a lot of trawling through forums and blogs I finally stumbled onto a fix... To demonstrate the fix let's run through the basic steps for adding Log4Net to a web project...

Read More