Compile C# from NPP



  • Hey guys, I’ve been fixated on this problem to the detriment of my other pursuits. I am trying to compile my c# code from npp using this guide… (https://dzone.com/articles/notepad-c-compiler-you-can-do)

    When I do Run>run the message I get in cmd is that the source file cannot be found and a warning 2008 that no source has been specified. I’ve double checked and the .cs files are present in the folder I list in the path. Please Help



  • @Jawz-Ferocity

    it might be that a space in the file path is breaking this,
    did you try to encase $(FULL_CURRENT_PATH) in double quotes?
    “$(FULL_CURRENT_PATH)”

    If this doesn’t help submit what you put into run menu and where your files are.
    In addition, I would recommend using nppexec instead of run menu anyway.

    Cheers
    Claudia



  • thanks for your help, this is what I input:
    cmd /k csc.exe “$(C:\Users\user1\Documents\MyFiles\sample.cs)”



  • @Jawz-Ferocity

    the $ is only needed if a variable needs to be expanded not if you provide the path manually.

    Cheers
    Claudia



  • @Jawz-Ferocity

    Perhaps the best way to explain it so that it is understood is that instead of doing

    cmd /k csc.exe “$(C:\Users\user1\Documents\MyFiles\sample.cs)”

    You should do

    cmd /k csc.exe “C:\Users\user1\Documents\MyFiles\sample.cs”

    Make sure that works, then change it to how you really should do it, and that is, have your file – C:\Users\user1\Documents\MyFiles\sample.cs – active in an editor tab, and then invoke exactly this:

    cmd /k csc.exe “$(FULL_CURRENT_PATH)”



  • That did it, thanks Claudia :-)



  • @Scott-Sumner said:

    Perhaps the best way to explain it so that it is understood is that instead of doing

    cmd /k csc.exe “$(C:\Users\user1\Documents\MyFiles\sample.cs)”

    You should do

    cmd /k csc.exe “C:\Users\user1\Documents\MyFiles\sample.cs”

    Make sure that works, then change it to how you really should do it, and that is, have your file – C:\Users\user1\Documents\MyFiles\sample.cs – active in an editor tab, and then invoke exactly this:

    cmd /k csc.exe “$(FULL_CURRENT_PATH)”

    TY guys I’m up and running.


Log in to reply