In Visual Studio:
- Right-click on your project
- Select Properties
- Select the Application tab
- Change the Target Framework to the desired framework
If you are not seeing .NET Framework 4 as an option there, ensure you have it installed.
EDIT
I don't think this is what you're asking, but for completeness, one can also point an existing DLL to a later version of the .NET Framework without recompiling using Binding Redirects.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…