I just finished rewriting an article I have written in 2007 about licensing a .Net application.
The original article still has a lot of reads and generates a lot of questions. The questions are mostly because the sample I wrote at that time was misleading and contained both the client application and the key generation parts.
I have recreated the sample in 3 different projects (a common class library, a test project and a key generation project). It should be easier for you to understand what goes where!
You can read it from http://emoreau.com/Entries/Articles/2015/11/Licensing-a-Net-application--2015-edition.aspx