I've been trying to find some examples or documentation for writing .Net plugins for NSClient++.
Can someone direct me to a working sample application or some documentation?
I found the source code for the CSharpSamplePlugin on GitHub. Since I don't use CMake, I made a new VS2013 project and added the three DLL's referenced in the CMake setup to my project (Google.ProtocolBuffers.dll
, NSCP.Core.dll
, and NSCP.Protobuf.dll
). I found the DLLs in the NSClient++ installation dir.
However it seems like the code in SamplePlugin.cs doesn't work with the current DLLs. I get an error on the line:
response.AddLines(Plugin.QueryResponseMessage.Types.Response.Types.Line.CreateBuilder().SetMessage("Hello from C#").Build());
... saying:
Error 2 'Plugin.QueryResponseMessage.Types.Response' does not contain a definition for 'Types' C:\vs_projects\NSClientHelpers\NsClientPlugin\SamplePlugin.cs 45 74 NsClientPlugin
Error 1 'Plugin.QueryResponseMessage.Types.Response.Builder' does not contain a definition for 'AddLines' and no extension method 'AddLines' accepting a first argument of type 'Plugin.QueryResponseMessage.Types.Response.Builder' could be found (are you missing a using directive or an assembly reference?) C:\vs_projects\NSClientHelpers\NsClientPlugin\SamplePlugin.cs 45 22 NsClientPlugin
So is there any place where I can find an updated sample plugin or example of how to make NSClient++ plugins?
After struggling with this for a while I just rewrote my commands as two standalone executables, but it irks me that I couldn't get this to work ;)
Cross posted to SO