« Previous Next »

Thread: Custom provider

Last post 06-20-2009 1:29 AM by kateroh. 4 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (5 items)

Sort Posts:

  • 04-17-2009, 10:51 AM

    • lawrencc
    • Not Ranked
    • Joined on 08-07-2008, 8:39 PM
    • Posts 3

    Custom provider

    I'm attempting to write a custom provider for MSDeploy. Unfortuantely it seems that the "add" method is never being called. What needs to occur for this method to run? I used the same structure as the example; however, I removed the GetStream flag and replaced most methods with file output statements that log to a file.

     Thanks!

  • 04-17-2009, 12:31 PM In reply to

    • yaminij
    • Top 50 Contributor
    • Joined on 09-25-2007, 12:41 AM
    • Posts 182

    Re: Custom provider

    The add method will get called only when you attempt to do a sync to a destination object. Could you tell us what you are attempting to do with your custom provider?

    Thanks
    Yamini Jagadeesan, SDET, Microsoft IIS Team
  • 04-17-2009, 1:05 PM In reply to

    • lawrencc
    • Not Ranked
    • Joined on 08-07-2008, 8:39 PM
    • Posts 3

    Re: Custom provider

     I'm attempting to write a provider that will allow me to remotely execute a batch or executable file on the destination machine.

  • 04-30-2009, 1:48 PM In reply to

    • yaminij
    • Top 50 Contributor
    • Joined on 09-25-2007, 12:41 AM
    • Posts 182

    Re: Custom provider

    You wouldnt have been able to serialize a batch file over to the destination machine in the RC version because DeploymentObject.GetStream() was not public in this release. However we fixed in the RC re-release, so you should be able to accomplish this without any issues. Please look at this sample  to see how to accomplish this.

    You would need to create a Stream of the batch file and return the stream inside the GetStream() override method.

    Then, inside of Add() method which gets executed on the destination, do a source.GetStream(), to obtain the source batch file stream, create a temporary .cmd file and execute it.

    Hope this helps. Please let us know if you would like us to put together a code sample for you.

    Thanks
    Yamini Jagadeesan, SDET, Microsoft IIS Team
  • 06-20-2009, 1:29 AM In reply to

    Re: Custom provider

    Add method gets called on a destination object whenever GetAttributes method throws a DeploymentException on that object. GetAttributes is used to validate the object without taking an action (on both source and destination) and Add method is used to validate the object and perform an action. Since the action takes place only on the destination object, you need to throw in GetAttributes method, so that Add() gets called, and then execute the commands in the batch.

    Check out this article about MSDeploy batch file provider with sample code and explanations.

    Thanks,
    Katerina Rohonyan, SDET, Microsoft IIS Team
Page 1 of 1 (5 items)