3

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.

daOnlyBG
  • 595
  • 4
  • 20
  • 49
  • Side note: consider getting Visual Studio if you just starting with C# - in general you'd find it easier to get help on IDE as a lot of people are using it. – Alexei Levenkov Aug 28 '15 at 17:20
  • @AlexeiLevenkov I appreciate the recommendation. Unfortunately, the PC I'm using is a company computer, and the only software available for me to download (for this sort of developing) is Notepad++. I would much rather prefer Visual Studio, but until they approve my request, I'm stuck using Notepad++ for some time. – daOnlyBG Aug 28 '15 at 17:34
  • I know that this might sound stupid... but... did you try saving the file (Ctrl + S) before running the plugin (with F6 I believe)? The changes are not written to the .cs file so the compiler will output the same executable. – darkArk Sep 11 '15 at 22:29
  • Another thing that might sound stupid: Is your program still running (e.g. inside npp_execs console? Check with the taskmanager. If this is the case, the compiler cannot recreate a the exe file. – Lars Fischer Sep 13 '15 at 14:52
  • 1
    Here is another thing that might sound stupid: in your nppexec script you have the compile and the execution after each other. Depending on the output of your program you might miss the compiler error messages. So you should split your script in two parts one for the compilation (your first line) and another one for the execution (your second line). This way you are able to inspect the compilation results for possible errors that would prevent the creation of a new executable. – Lars Fischer Sep 18 '15 at 19:21
  • @LarsFischer your last suggestion was definitely not stupid in my opinion; as a novice, it's easy to overlook those cases. I'm going to split the script in two. Thank you! – daOnlyBG Sep 18 '15 at 19:28

1 Answers1

1

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++.)

miroxlav
  • 11,796
  • 5
  • 58
  • 99
  • can you extrapolate on your first suggestion a bit more? do I literally copy and paste "copy $(FULL_CURRENT_PATH) currentversion.txt" in between my two lines? – daOnlyBG Sep 18 '15 at 19:33
  • also, the company I work for has well over 250 computers- in fact, well over 250,000 computers- so the community edition, sadly, isn't a possibility – daOnlyBG Sep 18 '15 at 19:34
  • @miroxlav- please see my comment above – daOnlyBG Sep 18 '15 at 19:51
  • Thanks @miroxlav. Can you extrapolate on your first suggestion in your answer, though? do I literally copy and paste "copy $(FULL_CURRENT_PATH) currentversion.txt" in between my two lines? – daOnlyBG Sep 18 '15 at 20:17
  • Insert this line: `cmd /c copy "$(FULL_CURRENT_PATH)" "$(CURRENT_DIRECTORY)\currentfile.txt"` So you should find your new file sitting in the same directory as the original. Tested - works. – miroxlav Sep 18 '15 at 20:39