2

I'm having reasonable results using CS-Script in Notepad++ (I can create, edit, run and debug basic C# scripts), but I must be missing something because I can't find a way to add References to the Script Project window.

For example, when I select "Load script from Current Document" it does a good job of loading the usual References (System.dll, System.Data.dll, etc.) however if I'm including a custom library that I've written myself (e.g. "using MyCompany.Library.EmailHelper") then I'm not seeing the DLL containing that library in the References list in the CS-Script Project window (and hence I can't get any intellisense for the classes in the library).

Without the reference, when I try to build the CS script I get numerous The type or namespace name '…' could not be found (are you missing a using directive or an assembly reference?) errors in the Notepad++ output window.

Unless I'm missing something obvious I can't see how I can manually add references via the CS-Script UI provided in Notepad++.

Andrew Jens
  • 1,032
  • 15
  • 16
  • Just a thought here, are your libraries registered in windows? Since npp reads all usual references maybe the fact that the custom library is not registered is causing the problem. – Jorge Campos Feb 22 '17 at 01:19
  • No the libraries aren't registered in Windows. I just tried to register them and got all sorts of "… was loaded but the entry-point DllUnregisterServer was not found" errors. To be honest I'm not that comfortable with registering every library that I want to try in Notepad++ with Windows because that may affect functionality in other programs running on the machine, and it seems like it could get messy with version control. – Andrew Jens Feb 22 '17 at 04:17
  • I did try to move the relevant DLLs into various Notepad++ directories such as: \plugins, \APIs, \CSScriptNpp, etc., but none of that caused the libraries to show up in the References list in the CS-Script Project window. Perhaps I have to make sure they are in the $PATH environment variable? – Andrew Jens Feb 22 '17 at 04:19
  • Yes, that was my second thought it may work. – Jorge Campos Feb 22 '17 at 05:01
  • I tried putting all the relevant libraries in a directory and then added that directory to the $PATH environment variable. I then restarted Notepad++ and tried to build the C# file. No luck I'm afraid. So I guess I'm out of ideas of how to add my own libraries to the References section in a CS-Script Project in Notepad++. – Andrew Jens Feb 22 '17 at 21:54

1 Answers1

2

Put all neccesary dll files within cs file directory.

On top of the file write

//css_args /ac

Then below that in the first using write

using dllName; without dll extension.

It should work.

John Nyingi
  • 951
  • 1
  • 16
  • 36
guestx
  • 36
  • 2
  • Hi guestx. Thanks, and your suggestion is a good one. I put the DLLs in the same folder as the CS file and they get included in the References section. It seems obvious now that you mention it. :-) – Andrew Jens Feb 27 '17 at 03:48
  • One thing though: if I include your "//css_args /ac" line, I get errors in the build, e.g. "Invalid token 'namespace' in class, struct, or interface member declaration", however if I leave the line out, the file builds without issue. I guess I have to read carefully the instructions at http://www.csscript.net/help/Directives.html. Out of interest, what is "/ac" trying to achieve? I also notice at that link the //css_reference" syntax … which I guess is a pretty close solution to my original question (e.g. it avoids having to copy DLLs into the same directory as the source code being built). – Andrew Jens Feb 27 '17 at 03:58