Solved

How to provide an additional/extra dll file when deployin a feature in sharepoint?

Posted on 2010-08-18
10
383 Views
Last Modified: 2012-05-10
In MOSS, I have a feature that has a receiver assembly and a receiver class specified. The receiver class extends SPFeatureReceiver. Inside the receiver class, I have implemented my code for the FeatureActived method.

My code inside the FeatureActivated method, is attaching an additional in-house dll to add an event to a given list.

In code it look similar to:
        MyList.EventReceiver.Add(SPEventRececeiverType.ItemAdding,
                                                    in-house-assembly, class-iniside-the-in-house-assembly)
 
where in-house-assembly contains teh assembly information and the class-inside-the-in-house-assembly is as per the name describes it.

So far, I have been able to make this solution to work on the condition that the additional in-house dll has been previously installed into the GAC (gacutil /if in-house-assembly.dll)

My question: is there any way I can provide the additional in-house dll as a file, module, resource or whatever other way, to the feature, and to make the feature to install this addditional dll int the GAC, before the FeatureActivated method being executed? If so, how can I achieve this?

Thank you in advance,


Edja
0
Comment
Question by:edgarmora4033
  • 6
  • 4
10 Comments
 
LVL 16

Expert Comment

by:raybies
ID: 33470840
Yes, your feature should be in a solution file (wsp), the solution file contains a manifest.xml, see code section.
There's an <Assemblies> node an under here you can add more dll's.
<?xml version="1.0" encoding="utf-8"?>

<Solution xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SolutionId="06da6001-f1b9-4f5e-82ad-fbc3939b067f" ResetWebServer="True" xmlns="http://schemas.microsoft.com/sharepoint/">

  <Assemblies>

    <Assembly Location="Services.SharePoint.tree.dll" DeploymentTarget="GlobalAssemblyCache"/>

    <Assembly Location="Services.SharePoint.FilterWebParts.dll" DeploymentTarget="GlobalAssemblyCache">

      <SafeControls>

        <SafeControl Assembly="Services.SharePoint.FilterWebParts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=2900282fd54adcc6" Namespace="Services.SharePoint.FilterWebParts" TypeName="*" Safe="True" />

      </SafeControls>

    </Assembly>

  </Assemblies>

  <FeatureManifests>

    <FeatureManifest Location="ContentConnector\feature.xml" />

    <FeatureManifest Location="CurrentPageFilter\feature.xml" />

    <FeatureManifest Location="DateFilter\feature.xml" />

    <FeatureManifest Location="QueryStringFilter\feature.xml" />

    <FeatureManifest Location="UserFilter\feature.xml" />

    <FeatureManifest Location="WebIDFilter\feature.xml" />

  </FeatureManifests>

</Solution>

Open in new window

0
 

Author Comment

by:edgarmora4033
ID: 33474863
raybies,

I am going to try your proposed solution. To me, it looks like it should work.

Question I have before Irying your proposed solution, is related with WSPBuilder. All my development has been done usiing WSPBuiilder. I do not find the manifest.xml file on my harddisk - I assume WSPBuilder removes the manifest.xml file as part of its cleanup process. So, do you know how can I achieve your proposed solution using WSPBuilder?

Thank you in advance,


Edja
0
 
LVL 16

Expert Comment

by:raybies
ID: 33481072
Event easier then just build the solution with your additional dll in the release folder.
0
 

Author Comment

by:edgarmora4033
ID: 33481605
raybies,

I need to understand what you are saying. Are you telling me that if I copy my additional  
in-house-assembly inside the release folder of the project that activate the feature,without telling anything on configuration files to the feature project or registering the dll in the gac, the feature will  recognized and it will work? Should I register the in-house-assembly in the references of the feature project (the one built using WSPBuilder)? I truly think, if your solution works, it will be the cleaneest solution for my problem.

Let me know your comments asap.


Edja
0
 
LVL 16

Accepted Solution

by:
raybies earned 500 total points
ID: 33481717
There's 3 ways to do it, but here's the easiest.

1.- Ctrl + C (copy) you additional dll eg: myextra.dll
2.- Go to your project eg: C:\project\myBlah\sp.blah\bin\Release
Ctrl + V (paste)
3.- Open your project with VS
4.- Set the project to build "Release"
5.- In solution explorer, right click the Project > WSPBuilder > Build WSP

Your wsp will now have the additional dll

Tried and tested right now.

You can also add it as a reference with copy local
or create a new directory called GAC on the project root and copy your dll there.


0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:edgarmora4033
ID: 33484763
raybies,

It worked perfect!

Thanks a lot.


Edja

P.S.: Last night I could not test because I did not have access to the machine that hosts my sharepoint development.

0
 

Author Closing Comment

by:edgarmora4033
ID: 33484800
Very clear instructions to follow.
Very helpful solution.

Thanks a lot!

Edja
0
 

Author Comment

by:edgarmora4033
ID: 33488626
raybies,

As a matter of technical interest, I would like you to add more info about the other 2 ways of getting same result.

I think another way will be configuring the library project to generate the release .dll file into the release folder of the WSPBilder project. Is this one of the other ways you were thinking? And which is(are) the other(s)?

Thank you,


Edja
0
 
LVL 16

Expert Comment

by:raybies
ID: 33489969
Edja, the other 2 ways:

1.- You can also add it as a reference with copy local
2.- create a new directory called GAC on the project root and copy your dll there.
0
 

Author Comment

by:edgarmora4033
ID: 33493712
raybies,

Thank you for your comments. First way I knew. Second one is new for me.

I appreciate this info.

Edja
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I used to be SharePoint evangelist in our company, so my Outlook always full of questions about how to do this, or where I can find that. One day I found such an email with the following question: "how to attach 3-State workflow (one of the workflow…
For SharePoint sites, particularly public-facing ones, there are times when adding JavaScript, Meta Tags, CSS Styles or other content to the page <head> section is more practical than modifying master pages.  For instance, you could add the jQuery l…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now