C# FAQ: What is a CSharp response file
Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio
| CSharp-Online.NET:FAQs |
| edit |
What is a C# response file?
There are times when a developer will want to use the C# compiler (csc.exe) from the Windows command line rather than Visual Studio .NET. But, entering lengthy command line switches can deter even the more intrepid programmers.
In this example, find a simple set of command line switches:
csc /r: MainAsm.dll;SecondAsm.dll /t: winexe /out: MainAppl.exe *.cs
To reduce the burden of typing long command line options, the C# command line compiler supports response files—text files which contain command line arguments to be feed to the compiler. Response files can save time and avoid typing errors. Response files end with the .rsp file extension.
For example, create the following text file named commandLine01.rsp:
/r: MainAsm.dll/r: SecondAsm.dll/t: winexe/out: MainAppl.exe *.cs# Response file comment.
Then, replace the lengthy command line switches with the name of the relevent response file for the current compilation using the @ symbol:
csc @commandLine01.rsp