« Previous Next »

Thread: Unknown factory 'commmandLine'

Last post 06-15-2009 12:40 AM by kateroh. 3 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (4 items)

Sort Posts:

  • 06-03-2009, 8:52 AM

    Unknown factory 'commmandLine'

    Hi,

    I'm trying to build a custom provider for executing commandLine or PowerShell commands and are running into problems during my initial testing. I have build an empty provider based on the mySQL example that do nothing but I can't get it to execute. I get the error:

    Unknown factory 'commmandLine'

    I have put the assembly in the using:

    gacutil /if MSDeploy.dll /f

    I have registered it in the registry using:

    reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\1\Providers\commandLine"  /v type /t REG_SZ /d "Concordia.Tools.MSDeploy.CommandLineProviderFactory, MSDeploy, Version=1.0.0.0, Culture=neutral, PublicKeyToken=58d853ef4d7b79b5"

     

    When i run MSDeploy in the command window the provider is listed but when I run:

    msdeploy -verb:sync -source:commmandLine="Test" -dest:commandLine="Test"

     

    It fails with:

    Unknown factory 'commmandLine'

     

    Any thoughts?

     

    code:

    Imports Microsoft.Web.Deployment

    Public Class CommandLineProvider

    Inherits DeploymentObjectProvider

    Protected Const providerName As String = "commandLine"

    Protected Const keyAttributeName As String = "path"

    Public Sub New(ByVal providerContext As DeploymentProviderContext, ByVal baseContext As DeploymentBaseContext)

    MyBase.New(providerContext, baseContext)

    End Sub

    Public Overrides ReadOnly Property Name() As String

    Get

    Return providerName

    End Get

    End Property

    Private ReadOnly Property Path() As String

    Get

    Return Me.ProviderContext.Path

    End Get

    End Property

    Public Overrides Function CreateKeyAttribute() As Microsoft.Web.Deployment.DeploymentAttribute

    Return New DeploymentAttribute(keyAttributeName, Me.Path, DeploymentAttributeFlags.InsensitiveCompare)

    End Function

    Public Overrides Sub Add(ByVal source As Microsoft.Web.Deployment.DeploymentObject, ByVal whatIf As Boolean)

    If whatIf Then

    Return

    End If

     

     

    End Sub

     

    End
    Class

    Public Class CommandLineProviderFactory

    Inherits DeploymentProviderFactory

    Public Overrides Function CreateProvider(ByVal providerContext As DeploymentProviderContext, ByVal baseContext As DeploymentBaseContext) As DeploymentObjectProvider

    Return New CommandLineProvider(providerContext, baseContext)

    End Function

    Public Overrides ReadOnly Property Description() As String

    Get

    Return "CommandLine custom provider"

    End Get

    End Property

    Public Overrides ReadOnly Property ExamplePath() As String

    Get

    Return "Test"

    End Get

    End Property

    Public Overrides Function GetSupportedSettings() As DeploymentProviderSettingInfo()

    Return New DeploymentProviderSettingInfo() {New CommandLinePath()}

    End Function

    Public Overrides ReadOnly Property FriendlyName() As String

    Get

    Return "commandLine"

    End Get

    End Property

    End Class

    Public Class CommandLinePath

    Inherits DeploymentProviderSettingInfo

    Public Sub New()

    End Sub

    Public Overrides ReadOnly Property Name() As String

    Get

    Return "commandLinePath"

    End Get

    End Property

    Public Overrides ReadOnly Property Description() As String

    Get

    Return "Description"

    End Get

    End Property

    Public Overrides ReadOnly Property Type() As Type

    Get

    Return GetType(String)

    End Get

    End Property

    Public Overrides Sub Validate(ByVal value As Object)

    End Sub

    Public Overrides ReadOnly Property FriendlyName() As String

    Get

    Return "commandLinePath"

    End Get

    End Property

    End Class

  • 06-04-2009, 3:02 PM In reply to

    • madjos
    • Not Ranked
    • Joined on 05-23-2008, 8:17 PM
    • Posts 11

    Re: Unknown factory 'commmandLine'

    Hi Hakan,

    Thanks for trying out MSDeploy. Hope you are finding it useful. 

    First off we realize that running a command line is a common task. In our next release we will have a built in provider that can accomplish this task. So if you prefer to wait a few months... Also in our next release we will have a different (simpler) way to register your providers (no registry access required).

    To debug your issue further, can you try:

     msdeploy -verb:dump -source:commandline="test" -debug

     msdeploy -verb:sync -source:commandline="test" -dest:commandline="test" -debug

    In the meantime, some guesses as to the problem you are seeing:

    the type you have used for the class does not match the value you put in the registry (namespace is different or class name is different).

    OR

    The CommandLineProviderFactory class is not public.

    Hope that helps,

    madhur

  • 06-04-2009, 6:01 PM In reply to

    Re: Unknown factory 'commmandLine'

    Hi madhur,

    I gave the dll to my colleague and he regestered the same way as I did and it works on his machine!

    Here is the debug message when i run:

    C:\Program Files\IIS\Microsoft Web Deploy>msdeploy -verb:dump -source:commandLine="test" -debug
    Microsoft.Web.Deployment.DeploymentException: Unknown factory 'commandLine'
       at Microsoft.Web.Deployment.DeploymentProviderOptions..ctor(String factoryName)
       at MSDeploy.MSDeploy.GetObjectParameters(Dictionary`2 parameters, Boolean isDestination, DeploymentBaseOptions& retbaseOptions, DeploymentProviderOptions& re
    tproviderOptions)
       at MSDeploy.MSDeploy.Execute()
       at MSDeploy.MSDeploy.Main(String[] unusedArgs)
    Error count: 1

    It is great that you will provide a command line task. We have our own PowerShell provider working for us right now on my colleauges machine and the server so a few months off is to far.

    Yes please make the registration simpler. You really need to work in the setup and registration on the server side as well. Maybe look at MEF for adding additional providers.

    I would also work on the naming of the metod names. They really do not make a lot of sense for an external developer like us. Names like SourceAction and DestinationAction or something like that would make more sense.

    If you could make more of the infrastructure interface based it would be much easier for us to do testing of our own code.

    /Hakan 

  • 06-15-2009, 12:40 AM In reply to

    Re: Unknown factory 'commmandLine'

    When you register your provider in registry:

    •  reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\1\Providers\commandLine"  /v type /t REG_SZ /d "Concordia.Tools.MSDeploy.CommandLineProviderFactory, MSDeploy, Version=1.0.0.0, Culture=neutral, PublicKeyToken=58d853ef4d7b79b5" 

    Concordia.Tools.MSDeploy should be your namespace for both your provider and factory,
    CommandLineProviderFactory should be your factory, and
    MSDeploy should be your provider, which according to your code is CommandLineProvider

     

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