问题
I activate my plugin using MAF[Managed Add - In Framework] in a separate process.
The problem is that it gives default name "AddInProcess32" to the each plugin which run as a separate process.
Can i give a custom name to the process which MAF create? If so how ?
PS: Why i want to give custom name? Because i do not want user to kill process by mistake... I want to give process a name which shows it is part of my app clearly.
回答1:
While desirable indeed, this is unfortunately not possible, as analyzed correctly by Dos095-russ already in his answer to the identical question How to specify AddIn process names? (+1 over there).
To make the bounty worth your while a bit at least, I'll add some context though:
The Filename for that process is hardcoded in the constructor of the AddInProcess Class due to the very purpose the class has been designed for, namely to Provide[s] an external process for running add-ins out-of-process from the host application. The specific mechanics are touched in the Remarks section:
The executable that runs the add-in is obtained from one of two files installed with the .NET Framework under the Windows directory. By default, the executable that matches the bits-per-word of the host application is used. If the host is a 64-bit process, AddInProcess.exe is run; otherwise, AddInProcess32.exe is run. To specify the way the executable is selected, use the AddInProcess(Platform) constructor to create the AddInProcess object.
The main reasons for why out-of-process add-ins might be needed by some applications are properly summarized in Danielg's answer to Choosing between MEF and MAF (System.AddIn). If those do actually not apply to your use case, you could explore the answers and links provided for Is MEF a replacement for System.Addin? in order to judge, whether the Managed Extensibility Framework (MEF) might be a better solution in fact - it's excellent for what it does btw., very easy to program with and widely used accordingly.
来源:https://stackoverflow.com/questions/8914183/give-maf-plugin-which-run-as-separate-process-a-custom-name