Well, I assume you are willing to create a windows application which can Build your project/solution/.cs File and create an executable as output.
To achieve this, you can call below command lines from you windows application. Example:
csc /out:My.exe File.cs
devenv /build Debug Solution.sln
This command will build File.cs and create and executable output. In similar lines you can also create DLLs.
For more information/variety on
csc.exe and msbuild commands, please refer to the below link and choose the one that suffice your requirement:
Command-line Building With csc.exe[
^]
How to Compile C# Solution using command prompt ?[
^]
Also, you can refer to
c# - Run Command Prompt Commands from C# Code- Stack Overflow[
^]