Plug-in: GAC, Database RRS feed

  • Question

  • I am developing a plug-in which I always register in the database. I now added some functionality that makes my plug-in dependent on an external dll. I then got the error that this dll is missing so I copied it to [Windir]\assembly. However, if I deploy my plug-in to the database it does not seems to see that assembly as it still complains about it. Is that expected behavior?

    I then started deploying my plug-in to the GAC also (using the Plugin Registration Tool). However, in this case the plug-in does not even seem to start (I have a log at the very beginning of Execute but the log stays empty).

    How can I get this plug-in to work and recognize the dependent dll?

    Monday, July 12, 2010 5:42 PM


All replies

  • You may use ILMerge to merge your plugin assembly and the dependent assembly into one, so that you can keep using database registration option. 
    Daniel Cai | http://danielcai.blogspot.com
    • Marked as answer by crm user 4950 Monday, July 12, 2010 9:35 PM
    Monday, July 12, 2010 7:02 PM
  • I tried that. Unfortunately, I am now at the point where neither the GAC nor Database works. I always get the error "An error has occurred. Try this action again. If the problem continues, ...." As mentioned, at the very beginning of the Execute function I add a log entry but I don't get that anymore. Therefore, it seems to fail even before the Execute function is called. Any ideas why that could be?
    Monday, July 12, 2010 8:32 PM
  • Did you sign your plug-in assembly using an .snk file? 
    Daniel Cai | http://danielcai.blogspot.com
    Monday, July 12, 2010 8:35 PM
  • weired, Here I have an application  which makes reference to other external dlls and works normally.

    External dll is in GAC (signed obviously).

    Plug dll is signed also and loaded to DB.

    Every time it is uploaded, MS ASYNCRONOUS SERVICE is restarted just in case.

    Yo can check log table WorkflowLogBase to see what real problem is.


    Monday, July 12, 2010 9:18 PM
  • Well, I had both assemblies signed. I did google ilmerge and some comments said that the resulting dll will have the same signature as the primary, at least that was my understanding. It turns out I needed they keyfile option in ILMerge to sign the combined assembly. Now it works both for GAC and database.

    Btw, what I also did not realize is that I have to physically copy the assemblies into the GAC. I though the Plugin Registration Tool would do this for me. But I guess it really does only register but not copy the dlls. That would be a major slowdown in development. Is this really the case you need to do it manually?

    Monday, July 12, 2010 9:29 PM
  • You shouldn't need to copy the assemblies to GAC. The best practice is to register the plug-in using the database option. It's fast and doesn't require iisreset or any file copy (if you do want to debug your plug-in, you should copy .pdb file to server\bin\assembly folder). 

    Daniel Cai | http://danielcai.blogspot.com
    Tuesday, July 13, 2010 5:26 AM