The DANSrv customization project creates a .NET assembly with the name NSPlugin.dll or NSPluginNet4.dll.
This DLL is called from the generic server DANSrv.exe (or DANSrvNet4.exe) and must therefore match the interface expected by the generic server.
NSPlugin should be built for "ANY CPU" so that it can be used with either the 32bit or 64bit generic server executable.
Be careful to copy the correct DANSrv.exe into the project directory, not the project output directory. The PostBuild step copies the file to the output directory and overwrites the file the maybe there.
The customization assembly may not be signed. The DANSrv.exe generic server was compiled with an unsigned NSPlugin.dll and the .NET Framework will throw an exception if the assembly is signed.
Project Base:
A new DANSrv customization project can:
-
be created with the new project wizard
The wizard creates a new Visual Studio project with either skeleton code or sample code according the dialog selections. -
be based on one of the sample applications
Copy the best fitted sample application into a new directory and make the following changes:-
open the copied project in Visual Studio and optionally change the solution and project name
-
open the file ServerAdapt.cs / .vb and change the server registration definitions in the method GetServerRegistryDef()
Unique GUIDs for the CLSID and APPID can be generate with the Visual Studio tool Create GUIDS -
open the Visual Studio project properties, select Configuration properties - debugging and change the Start Application path to DANSrv.exe in the project target directory. Visual Studio defines an absolute path that still points to the project that was copied.
-
build the project with the post build event that copies the additional files and registers the server with DCOM.
The copied sample application now runs under a new ProgID. -
make the functional program changes
-
The project Assembly Name must always be NSPlugin and the output file NSPlugin.dll !
To debug the application the Visual Studio Debugging configuration properties must be set to:
- Mode: Start external program
- Start program: bin/DANSrv.exe in the current project directory. Be careful, Visual Studio stores an absolute path.