Compiling C # using csc.exe from Notepad ++ using NPPExec script

I'm having trouble writing an NPPExec script (for Notepad ++) to compile a C # source using Microsoft csc.exe. I had no problems starting MinGW and running for my C ++ material, but the same script structure does not seem to work for C #. Does anyone have a working C # NPPExec script?

Three quick notes:

  • While my mingw is set to a path with no spaces (\ MinGW \ bin), it looks like my C # compiler is like \ Program Files \, a path with several spaces. Does it matter?

  • I was able to compile using the Microsoft SDK command line (which I think sets some environment variables), so I know that the compiler works.

  • In the NPPExec window, I selected FOLLOW $ (CURRENT_DIRECTORY). Does it matter?

Thank.

+3
source share
1 answer

Here is my nppexec script for C # (.NET 3.5) to compile the current open file and run:

"c:\WINDOWS\Microsoft.NET\Framework\v3.5\csc.exe" /out:"$(FULL_CURRENT_PATH).exe" "$(FULL_CURRENT_PATH)"
"$(FULL_CURRENT_PATH).exe"

In the menu "Plugins → NppExec":

Select "Save all files on execute"
Select "Follow $(CURRENT_DIRECTORY)".

Answers to your questions:
1) Use double quotes (") for the full csc path, for example, my configuration.
2) At least for .NET 3.5, only the full path to csc is enough, there is no need to load VS environment variables.
3) It is better to choose "FOLLOW $ (CURRENT_DIRECTORY)" so that the compiled EXE is in the same directory.

+16
source

Source: https://habr.com/ru/post/1736292/


All Articles