How to pass commandline arguments to csharp-shell










0















I try to call the csharp shell this way:



csharp proc.cs /storage


csharp error CS2007: Unrecognized command-line option: '/storage'



The 'man' file is unclear about options - they are shown in the parameters list, but never explained, man says:



csharp [--attach PID] [-e EXPRESSION] [file1 [file2]] [options]


Even if I use:



csharp proc.cs p1 p2 /storage


the error is the same. The leading slash is not accepted, even not, if it is escaped (which I explicitely wish to prevent me to do).
This looks like bad design.
Is there probably a workaround?










share|improve this question






















  • According to the documentation, "csharp is an interactive C# shell that allows the user to enter and evaluate C# statements and expressions from the command line." It's not meant to compile and run a .cs file. Are you confusing it with csc.exe? Or am I looking at the wrong documentation?

    – Rufus L
    Nov 14 '18 at 5:34












  • Not absolutely sure - but what will a shell be, if it cannot execute a script? From 'man': Files specified in the command line will be loaded and executed as scripts. Starting with Mono 2.10, the csharp command can be used as an interpreter executed by executables flagged with the Unix execute attribute. To do this, make the first line of your C# source code look like this: "#!/usr/bin/csharp" The latter should support my opinion ;-) The behavior, I explained, is the same in both cases.

    – mabra
    Nov 14 '18 at 5:56












  • Yeah, but it also says, "[.cs files] should only contain statements and expressions, they can not contain full class definitions (at least not as of Mono 2.0). Full class definitions should be compiled into dlls and stored in that directory.". Given this, it's not clear to me what /storage is supposed to do in your case. The shell executes commands. It doesn't compile an executable. So your .cs file should only contain lines like Console.WriteLine("Hello World"); or int AnswerToLife = 42;

    – Rufus L
    Nov 14 '18 at 6:36
















0















I try to call the csharp shell this way:



csharp proc.cs /storage


csharp error CS2007: Unrecognized command-line option: '/storage'



The 'man' file is unclear about options - they are shown in the parameters list, but never explained, man says:



csharp [--attach PID] [-e EXPRESSION] [file1 [file2]] [options]


Even if I use:



csharp proc.cs p1 p2 /storage


the error is the same. The leading slash is not accepted, even not, if it is escaped (which I explicitely wish to prevent me to do).
This looks like bad design.
Is there probably a workaround?










share|improve this question






















  • According to the documentation, "csharp is an interactive C# shell that allows the user to enter and evaluate C# statements and expressions from the command line." It's not meant to compile and run a .cs file. Are you confusing it with csc.exe? Or am I looking at the wrong documentation?

    – Rufus L
    Nov 14 '18 at 5:34












  • Not absolutely sure - but what will a shell be, if it cannot execute a script? From 'man': Files specified in the command line will be loaded and executed as scripts. Starting with Mono 2.10, the csharp command can be used as an interpreter executed by executables flagged with the Unix execute attribute. To do this, make the first line of your C# source code look like this: "#!/usr/bin/csharp" The latter should support my opinion ;-) The behavior, I explained, is the same in both cases.

    – mabra
    Nov 14 '18 at 5:56












  • Yeah, but it also says, "[.cs files] should only contain statements and expressions, they can not contain full class definitions (at least not as of Mono 2.0). Full class definitions should be compiled into dlls and stored in that directory.". Given this, it's not clear to me what /storage is supposed to do in your case. The shell executes commands. It doesn't compile an executable. So your .cs file should only contain lines like Console.WriteLine("Hello World"); or int AnswerToLife = 42;

    – Rufus L
    Nov 14 '18 at 6:36














0












0








0








I try to call the csharp shell this way:



csharp proc.cs /storage


csharp error CS2007: Unrecognized command-line option: '/storage'



The 'man' file is unclear about options - they are shown in the parameters list, but never explained, man says:



csharp [--attach PID] [-e EXPRESSION] [file1 [file2]] [options]


Even if I use:



csharp proc.cs p1 p2 /storage


the error is the same. The leading slash is not accepted, even not, if it is escaped (which I explicitely wish to prevent me to do).
This looks like bad design.
Is there probably a workaround?










share|improve this question














I try to call the csharp shell this way:



csharp proc.cs /storage


csharp error CS2007: Unrecognized command-line option: '/storage'



The 'man' file is unclear about options - they are shown in the parameters list, but never explained, man says:



csharp [--attach PID] [-e EXPRESSION] [file1 [file2]] [options]


Even if I use:



csharp proc.cs p1 p2 /storage


the error is the same. The leading slash is not accepted, even not, if it is escaped (which I explicitely wish to prevent me to do).
This looks like bad design.
Is there probably a workaround?







c# command-line-arguments






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 14 '18 at 5:10









mabramabra

188410




188410












  • According to the documentation, "csharp is an interactive C# shell that allows the user to enter and evaluate C# statements and expressions from the command line." It's not meant to compile and run a .cs file. Are you confusing it with csc.exe? Or am I looking at the wrong documentation?

    – Rufus L
    Nov 14 '18 at 5:34












  • Not absolutely sure - but what will a shell be, if it cannot execute a script? From 'man': Files specified in the command line will be loaded and executed as scripts. Starting with Mono 2.10, the csharp command can be used as an interpreter executed by executables flagged with the Unix execute attribute. To do this, make the first line of your C# source code look like this: "#!/usr/bin/csharp" The latter should support my opinion ;-) The behavior, I explained, is the same in both cases.

    – mabra
    Nov 14 '18 at 5:56












  • Yeah, but it also says, "[.cs files] should only contain statements and expressions, they can not contain full class definitions (at least not as of Mono 2.0). Full class definitions should be compiled into dlls and stored in that directory.". Given this, it's not clear to me what /storage is supposed to do in your case. The shell executes commands. It doesn't compile an executable. So your .cs file should only contain lines like Console.WriteLine("Hello World"); or int AnswerToLife = 42;

    – Rufus L
    Nov 14 '18 at 6:36


















  • According to the documentation, "csharp is an interactive C# shell that allows the user to enter and evaluate C# statements and expressions from the command line." It's not meant to compile and run a .cs file. Are you confusing it with csc.exe? Or am I looking at the wrong documentation?

    – Rufus L
    Nov 14 '18 at 5:34












  • Not absolutely sure - but what will a shell be, if it cannot execute a script? From 'man': Files specified in the command line will be loaded and executed as scripts. Starting with Mono 2.10, the csharp command can be used as an interpreter executed by executables flagged with the Unix execute attribute. To do this, make the first line of your C# source code look like this: "#!/usr/bin/csharp" The latter should support my opinion ;-) The behavior, I explained, is the same in both cases.

    – mabra
    Nov 14 '18 at 5:56












  • Yeah, but it also says, "[.cs files] should only contain statements and expressions, they can not contain full class definitions (at least not as of Mono 2.0). Full class definitions should be compiled into dlls and stored in that directory.". Given this, it's not clear to me what /storage is supposed to do in your case. The shell executes commands. It doesn't compile an executable. So your .cs file should only contain lines like Console.WriteLine("Hello World"); or int AnswerToLife = 42;

    – Rufus L
    Nov 14 '18 at 6:36

















According to the documentation, "csharp is an interactive C# shell that allows the user to enter and evaluate C# statements and expressions from the command line." It's not meant to compile and run a .cs file. Are you confusing it with csc.exe? Or am I looking at the wrong documentation?

– Rufus L
Nov 14 '18 at 5:34






According to the documentation, "csharp is an interactive C# shell that allows the user to enter and evaluate C# statements and expressions from the command line." It's not meant to compile and run a .cs file. Are you confusing it with csc.exe? Or am I looking at the wrong documentation?

– Rufus L
Nov 14 '18 at 5:34














Not absolutely sure - but what will a shell be, if it cannot execute a script? From 'man': Files specified in the command line will be loaded and executed as scripts. Starting with Mono 2.10, the csharp command can be used as an interpreter executed by executables flagged with the Unix execute attribute. To do this, make the first line of your C# source code look like this: "#!/usr/bin/csharp" The latter should support my opinion ;-) The behavior, I explained, is the same in both cases.

– mabra
Nov 14 '18 at 5:56






Not absolutely sure - but what will a shell be, if it cannot execute a script? From 'man': Files specified in the command line will be loaded and executed as scripts. Starting with Mono 2.10, the csharp command can be used as an interpreter executed by executables flagged with the Unix execute attribute. To do this, make the first line of your C# source code look like this: "#!/usr/bin/csharp" The latter should support my opinion ;-) The behavior, I explained, is the same in both cases.

– mabra
Nov 14 '18 at 5:56














Yeah, but it also says, "[.cs files] should only contain statements and expressions, they can not contain full class definitions (at least not as of Mono 2.0). Full class definitions should be compiled into dlls and stored in that directory.". Given this, it's not clear to me what /storage is supposed to do in your case. The shell executes commands. It doesn't compile an executable. So your .cs file should only contain lines like Console.WriteLine("Hello World"); or int AnswerToLife = 42;

– Rufus L
Nov 14 '18 at 6:36






Yeah, but it also says, "[.cs files] should only contain statements and expressions, they can not contain full class definitions (at least not as of Mono 2.0). Full class definitions should be compiled into dlls and stored in that directory.". Given this, it's not clear to me what /storage is supposed to do in your case. The shell executes commands. It doesn't compile an executable. So your .cs file should only contain lines like Console.WriteLine("Hello World"); or int AnswerToLife = 42;

– Rufus L
Nov 14 '18 at 6:36













0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53293540%2fhow-to-pass-commandline-arguments-to-csharp-shell%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53293540%2fhow-to-pass-commandline-arguments-to-csharp-shell%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3