Solved

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

Posted on 2010-08-18
10
400 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

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
 

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Work Over Net is a new and very powerful collaboration product. With its new easy interface it is becoming very competitive to other similar products like webex and office interactive. WON 2010 have the standard business tools needed for multi-offic…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

813 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

11 Experts available now in Live!

Get 1:1 Help Now