To create a DLL File, click on New project, then select Class Library.
Enter your code into the class file that was automatically created for you and then click Build Solution from the Debug menu.
Now, look in your directory: ../debug/release/YOURDLL.dll
There it is! :)
P.S.
DLL files cannot be run just like normal applciation (exe) files. You'll need to create a separate project (probably a win forms app) and then add your dll file to that project as a "Reference", you can do this by going to the Solution explorer, right clicking your project Name and selecting Add Reference then browsing to whereever you saved your dll file.
Then, to be able to use this dll file, in your projects code, you call the methods inside the dll file. For example:
If, in your DLL file you have a method like this:
public string somerandommethod()
{
string x = "something";
return x;
}
Then, in your Form1.cs file of your separate project, you would call the code from your dll file like this:
button1_Click(object sender, EventArgs e)
{
MyDllFile dll = new MyDllFile();
MessageBox.Show(dll.somerandommethod());
}
I hope this has helped you