Solved

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

Posted on 2010-08-18
10
393 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I recently came across an issue with a MOSS 2007 deployment where access into some sub-sites were denied, even for the MOSS farm administrators. A bit of background to the setup of this MOSS farm; this was a three server setup, consisting of a fr…
We had a requirement to extract data from a SharePoint 2010 Customer List into a CSV file and then place the CSV file into a directory on the network so that the file could be consumed by an AS400 system. I will share in Part 1 how to Extract the Da…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

895 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

13 Experts available now in Live!

Get 1:1 Help Now