Use response files to compile C # source files

Source: Internet
Author: User
Compile several cs source files in the command line, which may be written as follows:
Csc.exe/out:. inMyAssembly. dll/t: library
/R: PATH1FirstAssemblydll, PATH2SecondAssemlbydll, etc
Src1.cs src2.cs etc
If you continue to reference a new assembly or create a new source file, you will have to modify this line of command. You can also put this line of command into one. bat file. the bat file can be compiled. However, there is another method that makes it easier to use, that is, to create a response file. The response file is a text file that can write compiler options in it, for example:
# Annotation, MyAssembly. rsp
# Begin
/Out:. inMyAssembly. dll
/Target: library
/Reference: PATH1FirstAssembly. dll, PATH2SecondAssembly. dll, etc
Src1.cs src2.cs etc
# End
Then I can compile the source code like this: csc.exe @ MyAssembly. rsp
In this way, no matter how the compiler options change or the source file changes, I only need to modify the content of the MyAssembly. rsp file, which is much more convenient than the previous one.
If EditPlus is used, you can add a user tool in the following format (I use the Chinese version of EditPlus ):
Menu text: csc
Command: csc.exe
Parameter: @ $ (FileName)
Initial Directory: $ (FileDir)
Capture output: Select
Content similar to $ (...) is generated by EditPlus. You can also create a template for the response file in EditPlus. After editing the source code, you only need to create a response file and add content similar to the above, then you can click the user tool under the "tool" menu to compile it (note that the response file is active). The compilation result will also be intercepted by EditPlus and output below, it's like an IDE.
In short, using the response file can simplify the compilation Command, and then use EditPlus to build a simple IDE, which is very convenient to use.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.