Solved

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

Posted on 2010-08-18
10
415 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

If you create your solutions on SharePoint sooner or later you will come upon a request to set  permissions of the item depending on some of the item's meta-data - the author, people assigned as approvers, divisions, categories etc. The most natu…
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

726 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