문제

I am trying to extend the Microsoft Web Deployment tool and MSDeploy with a custom provider because I want to run custom tasks on the destination deployment machine as part of the process. The general documentation is pretty good outside of custom provider development, but the documentation for doing any sort of extension seems to be non-existent towards abysmal.

I've been researching this for several days now and have found some bits and pieces that have allowed me to get pretty far into the process without any real documentation. I've almost hacked my way through the process but now I have one final problem: MSDeploy will not recognize my custom provider.

I have created two classes one that extends Microsoft.Web.Deployment.DeploymentProviderFactory (which has both the Name and FriendlyName properties overriden to the name of my custom provider "archimedes"); the other extends Microsoft.Web.Deployment.DeploymentObjectProvider which also has an overriden Name property "archimedes". I did this by following the custom BatchProvider example you can find online. It looks like this:

ArchimedesProviderFactory (which extends DeploymentProviderFactory and has the Deployment ProviderFactory attribute assigned to the class):

public override string FriendlyName
{
    get { return "archimedes"; }
}

public override string Name
{
    get { return "archimedes"; }
}

The ArchimedesProvider class extends DeploymentObjectProvider and has this:

public override string Name
{
    get { return "archimedes"; }
}

In my sourcemanifest.xml file I have it added an entry:

<archimedes path="..." />

I have placed the assembly file that contains those classes in %program files%\IIS\Microsoft Web Deploy\Extensibility as I was directed too by the material I found online.

The funny thing is that during the build of a package in Visual Studio 2010, my providers are having code called on them from that directory - so VS is definitely connecting to my assembly placed in there somehow (for example I can throw exceptions and see that they were thrown during the process of building a package).

However during actual test deployment of the package from the generated .cmd file, I get an error that the factory for provider "archimedes" cannot be found. Also typing:

MSDeply -verb:dump -source:archimedes -debug

Returns the following:

    Microsoft.Web.Deployment.DeploymentException: Unknown factory 'archimedes'.
   at Microsoft.Web.Deployment.DeploymentProviderSettingCollection..ctor(String factoryName)
   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.ExecuteWorker()
   at MSDeploy.MSDeploy.Execute()
   at MSDeploy.MSDeploy.Main(String[] unusedArgs)
Error count: 1.

So besides the fact that there appears to be no coherent, central source of documentation for custom provider development (does anyone know of a place, please do tell if you found one), my main problem is that for some reason Visual Studio will see and call my provider factory from the assembly file I dumped into the Extensibility folder, but the actual msdeploy/webdeploy does not see it. Does anyone have any ideas?

Thanks a ton...

도움이 되었습니까?

해결책

OK, this was a simple mistake, although a non-obvious one since the package building portion accessed the code alright and called it from my provider assembly. The problem was that since just about everything in the web application targets the 4.0 framework the class library project I added with the custom provider code did as well. I had to set the target framework to 2.0 and it all started working. None of the error reporting was overly obvious.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top