开发者

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

开发者 https://www.devze.com 2022-12-22 06:39 出处:网络
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 struct

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 n开发者_C百科o 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号