Search code examples
c#powershellcmdnotepad++nppexec

NppExec in Notepad++ Not Recompiling My C# Code


I seem to be having an issue with the NppExec plugin for Notepad++. I'm new to coding in the Windows environment, so it's conceivable I'm missing something fairly obvious.

A few days ago, I got the NppExec plugin to work on Notepad++. In the NppExec plugin, under the "Execute" window, I have this saved:

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

When I compile the C# code for the first time, everything works as it should. If I were to make a small change- something as simple as writing

Console.WriteLine("testing: 1,2,3");

in the bottom of the Main method, the Notepad++ software does not tell the compiler to recompile the file. In stead, executing the code again simply runs the past version (even despite saving my changes) of my code all over again.

Does anyone understand why this is happening, and what I can do to have Notepad++ tell the compiler to recompile the file?

Thank you in advance.


Solution

  • I have two approaches for you:

    1. Improve your Npp Exec script to dump $(FULL_CURRENT_PATH) file somewhere before compiling.

    • cmd /c copy "$(FULL_CURRENT_PATH)" "$(CURRENT_DIRECTORY)\currentfile.txt"
    • This way you will understand what code is actually handed out from Notepad++ to the compiler.

    2. You do not need to purchase Visual Studio. (Just download and use like Notepad++.)