Recently began to learn C #, to see the Chen Guang Teacher's tutorial, the video with the development tool is sharpdevelop, the tool does not compile a single file function, the establishment of a large pile of documents too much trouble, Baidu found a bit of relevant information is very little (or I can not find information ability), and then found a good article " How to compile a single CS file: http://xloved.blog.163.com/blog/static/18571909420114854026152/", the effect is really good after the attempt, the individual on this basis to improve a little improvement.
First step: Create a bat batch. Create a consolecomplier.bat batch file with Notepad that reads as follows:
C:\windows\microsoft.net\framework\v4.0.30319\csc.exe/t:exe%1
%~n1
@pause
Del%~n1.exe
Explain:
First line: To. NET directory down with the csc.exe compiler to compile the current CS file, the path parameter is provided by the SD "${itempath}"
Second line: Execute the compiled EXE file
Third line: Prompt "Press any key to continue", waiting for user input
Row four: Delete the compiled generated EXE file for the next recompile preparation.
Step two: Set the SD. Save the Complier.bat anywhere (I put it in the SD installation directory), open the SharpDevelop, tools----tools----tool---and expand Tools, by setting the menu bar.
Click "Add" button to add a tool, the title is called "Consolecomplier" or "Complie and Run" What to do with it, and then note that the command column is just the path of the Complier.bat, parameters: "${itempath}" (including double quotes), working directory: ${itemdir} (no double quotes), click on the "Move Up" button to move our tool to the first, finally click on the "OK" button to save the settings, done!
Step three: use. Click on the menu Bar Tool menu, you can see the tools we added, click to use, since we have moved it to the top, so the use of the shortcut "Alt+t+enter" can be called, is it convenient?
Summary: In the process of modifying batch processing to find their own batch processing knowledge is very scarce, there is time (hehe) must be a bad fix ...
Configure SharpDevelop to compile a single CS file