Custom WebService and Feature Receiver - Deployment

Nov 13, 2008 at 12:58 PM
Edited Nov 13, 2008 at 6:51 PM
Yet another deployment senario. I need to deploy a custom webservice.
The problem here is not the service it self, I´m planning to use SPWebServiceDeploy that fixes move, renaming, disco, wdsl senarios with a feature recevier.  (http://www.codeplex.com/SPWebServiceDeploy)

The problem here is to deploy a feature recevier with VSeWSS 1.2.
I link to the assembly and to the asmx file from it´s project. I have a feature.xml file, like:

 

<Feature xmlns="http://schemas.microsoft.com/sharepoint/"
    Id="D758B895-6078-45a8-BCA5-8A2322A78E02"
    Creator="Leon Land Gersing | fallenrogue.com"
    Description="This feature is a Hello World Web Service that should deploy with 0 touch."
    ReceiverAssembly="LLG.SharePoint.SPWebServiceDeployment, Version=1.0.0.0, Culture=neutral, PublicKeyToken=124af203ac616cdb"
    ReceiverClass="LLG.SharePoint.SPWebServiceDeployment.DiscoverWebServicesFeatureReceiver"
    Scope="Farm"
    Title="DiscoverWebServices"
    Version="1.0.0.0"
    AlwaysForceInstall="true"
    Hidden="true"
    >
 <ElementManifests>
  <ElementFile Location="HelloWorldWebService.asmx"/>
 </ElementManifests>
</Feature>

To add a new Feature in WSP view is no problem, but to add a file with the feature...
But how do I get VSeWSS to show deploy and show my feature recevier and file in WSP view ?

Any hints?

peace.

Nov 14, 2008 at 4:28 PM
Edited Nov 14, 2008 at 10:27 PM
Ok, the file and receiver in place, all in WSP.
Check this article for more help:
http://blog.tylerholmes.com/2008/03/walkthrough-creating-sharepoint-feature.html

BUT, When I do this from scratch it works, sometimes :), done it twice.

But most of this times I try to apply this solution I run into this:

Error 102 Failed to create feature receiver object from assembly "Client.Project, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5", type "Client.Project.FeatureReceiver" for feature 7bf5be22-0355-459a-8ee4-95bae87a9590: System.ArgumentNullException: Value cannot be null.
Parameter name: type
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject()  0 0 

It seems that the settings below, is a bit unclear. (see http://sharepointers.blogspot.com/2008/05/error-failed-to-create-feature-receiver.html), any help, hints ?
Peace.

 

ReceiverAssembly
ReceiverClass

 

 

 

 

Nov 17, 2008 at 6:31 PM
VSeWSS does some automatic magin with SPFeatureReceiver derived classes. So you should be aware of a few nuances. When you're creating the feature receiver are you providing a Guid attribute to your feature receiver class?
Nov 24, 2008 at 8:32 AM
I got the recevier to work/deploy. I excluded the the reciver for the project for some time, working on other parts. I few days later I included it again, then it deployed.
Unfortunly, due to this lucky coincidence,  I don´t have any more information on how the problem was solved.

The SPFeatureReceiver is not decorated with a guid.
Should I do that, if so why?
These nuances, are there any further info about them that I can read for easier FeatrueReceiver development/deployment with VSeWSS ?

Nov 26, 2008 at 6:53 PM
In the guidance package the FeatrueReceiver classes are decorated with a guid.
What does that guid do ?

Nov 26, 2008 at 9:29 PM
VSeWSS finds any classes in your project that derive from SPFeatureReceiver and tries to create an an empty feature to call the feature receiver. I think this only happens when you have a site definition in your project, not quite sure there. The Guid is needed because when it generates the empty feature it provisions the name of the feature with something like this...SiteProvisioning[guid here]. If you don't provide one it will look like this SiteProvisioning00000000-0000-0000-0000-000000000000. If you have multiple feature receivers without GUIDs you can see how you could run into some deployment issues.

 

Nov 27, 2008 at 9:22 AM
Great!

I have no site defenition in my project. In the WSP view I have to add feature receivers manually.
So it could be a site defention thing. But it would be a good practice to alwas have your featurereceiver decorated with a guid then.

Thanks!

Apr 2, 2009 at 10:24 AM
Hi, I have this exact problem - I have 2 feature receivers in my project and WSP view is complaining becasue it is creating 2 empty features with empty Guids. So, this should be no problem, I can just decorate my receiver class with [Guid("my feature guid")] and everything will work.
The only problem is, this does not compile, I get the following error:
"System.Guid" is not an attribute class

Is there some reference I need, or some other steps I need to take? I can't find any documentation anywhere!
Apr 3, 2009 at 2:32 PM
Hi Mike,

the GuidAttribute is defined in system.dll, so it should not be an issue with an assembly reference.

The form should look something like:
[ Guid("cc0f379e-f077-400f-81bb-1e15b2d36464")]
public class WebFeatureReceiver : SPFeatureReceiver

 

I just built a simple console app for this:
using System;
using System.Runtime.InteropServices;

 

namespace testguidattr
{
    class Program
    {
        static void Main(string[] args)
        {
        }
    }

    [Guid("cc0f379e-f077-400f-81bb-1e15b2d36464")]
    class Dummy
    {
    }
}