1

I'm creating a WSP package in Visual Studio 2010 to deploy my feature to the Sharepoint 2007 environment on a Windows 2003 Server box. Currently, the xml file that references the assembly containing the code I have written is referenced from the GAC. What I'd like to do is make it so this WSP file will add the dll to the assembly automatically and then reference it so the feature can be properly installed. Is this possible? If so, how is this done?

I have my ListManifest.xml file as follows:

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Receivers ListTemplateId="101">
    <Receiver>
        <Name>AddedEventHandler</Name>
        <Type>ItemAdded</Type>
        <SequenceNumber>10000</SequenceNumber>
        <Assembly DeploymentTarget="GlobalAssemblyCache" Location="SPEventHandler.dll"/>
        <Class>SPEventHandler.ItemAddedHandler</Class>
        <Data></Data>
        <Filter></Filter>
    </Receiver>
</Receivers>

As you can see, it references the SPEventHandler assembly in the GAC, but I'd like the program to have my DLL included in the assembly, add it to the GAC and reference it.

Thanks for your help in advance.

My DDF file:

.OPTION Explicit ; Generate errors
.Set DiskDirectory1="..\bin"
.Set CabinetNameTemplate="ChangeContentType.wsp"

manifest.xml
.Set DestinationDir="List\ListTemplates"
List\ListTemplates\ListManifest.xml ; specify cab file name
.Set DestinationDir="List\Messages"
List\Messages\schema.xml
.Set DestinationDir="List"
List\Feature.xml
..\bin\SPEventHandler.dll SPEventHandler.dll

manifest.xml :

<?xml version="1.0" encoding="utf-8"?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/"
   SolutionId="F9850E13-81B6-47E1-BBC6-42AC70A903C3" >
   <FeatureManifests>
       <FeatureManifest Location="List\Feature.xml"/>
   </FeatureManifests>
</Solution>

1 Answer 1

4

If you are packaging your wsp manually, then you need to include your dll in your DDF file, e.g.

bin\Debug\MyFile.dll MyFile.dll

and you include the assembly in the solution manifest, e.g.

<Assemblies>
  <Assembly DeploymentTarget="GlobalAssemblyCache" Location="MyFile.dll" />
</Assemblies>

Here is an MSDN reference

If you do not want to do this manually, you can take a look at WSPBuilder.

8
  • I added my ddf file to the original question text. Do I just add the line for the DLL at the bottom or do I need to do a .Set DestinationDir="" ?
    – Music Magi
    Jun 3, 2011 at 19:05
  • 1
    Just add the line to the bottom of your DDF.
    – Laurie
    Jun 3, 2011 at 19:08
  • Cool. Also, can I use the following syntax to access a file in a different folder: ..\..\SPEventHandler\bin\Debug\SPEventHandler.dll SPEventHandler.dll ?
    – Music Magi
    Jun 3, 2011 at 19:13
  • 1
    The path should be to the bin folder in your project. Make sure that the dll is in that folder.
    – Laurie
    Jun 3, 2011 at 19:17
  • 1
    You can verify that the dll is in your wsp by renaming it to .cab and extracting the files. As far as the Assembly node, that belongs in the manifest.xml file and should not have a path in it. Take a look at the MSDN instructions for where to put that node.
    – Laurie
    Jun 3, 2011 at 20:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.