Search code examples
c#nppexec

N++ throwing error while compiling the C# program using NppExec plugin?


I have wrote a program to check the N++ that if it works with C# programs to execute directly within it, I set it up using NppExec plugin and set the path for the script is

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

my simple written program to check it is,

static void Main(string[] args)
      {
      sayHello();
      Console.Read();
      }

       static void SayHello()
       {
       Console.Write("Hello World!, I'm practicing at the moment.");
       }             

When I compile it hitting F6 it throws the error

Process started >>> Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.4926 for Microsoft (R) .NET Framework version 3.5 Copyright (C) Microsoft Corporation. All rights reserved.

My_practice.cs(12,4): error CS0103: The name 'sayHello' does not exist in the current context
<<< Process finished. (Exit code 1)
"D:\My_practice.cs.exe" CreateProcess() failed with error code 2:
The system cannot find the file specified.

While there is no error in my program checking on VS.


Solution

  • C# is case sensitive. The sayHello() call should be SayHello().

    static void Main(string[] args)
    {
       //sayHello();   <-- Invalid due to lowercase "s"
       SayHello();
       Console.Read();
    }
    
    static void SayHello()
    {
       Console.Write("Hello World!, I'm practicing at the moment.");
    }