tags:

views:

315

answers:

1

Hi all -

I'm having trouble writing a NPPExec script (for Notepad++) to compile C# source using Microsoft's csc.exe. I had no problem getting MinGW up and running for my c++ stuff, but the same script structure doesn't seem to work for C#. Does anybody have a working C# NPPExec script?

Three quick notes: 1)While my mingw installed to a path with no spaces (\MinGW\bin), it appears that my C# compiler is buried in \Program Files\, a path with multiple spaces. Does this matter?

2) I was able to compile using the Microsoft SDK-installed command prompt (which I think sets some environment variables), so I know the compiler works.

3) In the NPPExec option box, I have selected FOLLOW $(CURRENT_DIRECTORY). Does this matter?

Thanks.

+5  A: 

Here is my nppexec script for C# (.NET 3.5) to compile the currently opened 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 "Plugins -> NppExec" menu:

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

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

Gnailiah Gnaw
Worked. Thanks much.
MikeRand
If it worked, accept my answer and vote me up. Thanks.
Gnailiah Gnaw
Sorry, don't have enough reputation to vote up yet. Will come back when I do.
MikeRand