Andrew Connell [MVP SharePoint]
1740 Posts |  46 Articles |  5310 Comments
.NET  |  MCMS  |  SharePoint  |  Office System
Andrew Connell's RSS Feed    
AC's Blog Quick Links
SharePoint Quick Links
Article Categories
Archives
May, 2012 (2)
April, 2012 (4)
March, 2012 (4)
February, 2012 (4)
January, 2012 (12)
December, 2011 (6)
November, 2011 (3)
October, 2011 (17)
September, 2011 (8)
August, 2011 (6)
July, 2011 (7)
June, 2011 (13)
May, 2011 (9)
April, 2011 (15)
March, 2011 (1)
February, 2011 (6)
January, 2011 (5)
December, 2010 (11)
November, 2010 (6)
October, 2010 (12)
September, 2010 (5)
August, 2010 (4)
July, 2010 (5)
June, 2010 (6)
May, 2010 (11)
April, 2010 (11)
March, 2010 (9)
February, 2010 (9)
January, 2010 (3)
December, 2009 (10)
November, 2009 (15)
October, 2009 (15)
September, 2009 (7)
August, 2009 (4)
July, 2009 (10)
June, 2009 (8)
May, 2009 (2)
April, 2009 (9)
March, 2009 (6)
February, 2009 (16)
January, 2009 (6)
December, 2008 (12)
November, 2008 (12)
October, 2008 (27)
September, 2008 (13)
August, 2008 (14)
July, 2008 (14)
June, 2008 (12)
May, 2008 (23)
April, 2008 (12)
March, 2008 (15)
February, 2008 (13)
January, 2008 (12)
December, 2007 (10)
November, 2007 (8)
October, 2007 (15)
September, 2007 (20)
August, 2007 (21)
July, 2007 (16)
June, 2007 (8)
May, 2007 (25)
April, 2007 (16)
March, 2007 (18)
February, 2007 (18)
January, 2007 (12)
December, 2006 (16)
November, 2006 (13)
October, 2006 (18)
September, 2006 (22)
August, 2006 (27)
July, 2006 (23)
June, 2006 (23)
May, 2006 (23)
April, 2006 (9)
March, 2006 (17)
February, 2006 (15)
January, 2006 (23)
December, 2005 (31)
November, 2005 (32)
October, 2005 (38)
September, 2005 (53)
August, 2005 (30)
July, 2005 (63)
June, 2005 (30)
May, 2005 (59)
April, 2005 (29)
March, 2005 (74)
February, 2005 (27)
January, 2005 (22)
December, 2004 (32)
November, 2004 (42)
October, 2004 (39)
September, 2004 (20)
August, 2004 (14)
July, 2004 (27)
June, 2004 (40)
May, 2004 (5)
April, 2004 (6)
March, 2004 (16)
February, 2004 (26)
January, 2004 (23)
December, 2003 (7)
November, 2003 (14)
October, 2003 (20)
September, 2003 (4)
Post Categories



Managed Windows Shared Hosting

The Problem

When you had custom code to deploy in WSS v2, primarily Web Parts, you packaged them up in a Web Part Package using WPPackager for deployment on your servers. Unfortunately it wasn't the easiest tool to use, nor was it error-free. Thankfully Microsoft has abandoned the WPPackager utility in WSS v3 in favor solution files. A solution file is a Windows SharePoint Services solution package that is really just a CAB with a WSP extension. You can use solutions to deploy Web Parts & associated files (such as resource files, images, CSS, etc), add safe control entries, deploy the CAS policy changes, features, and so on… (read the documentation in the WSS SDK linked at the end of this post for more info).

The only downside is that building CAB files isn't the easiest or most straightforward thing to do. Visual Studio 2005 includes a setup project template that you can use to include another project's output, but it has two limitations… one very big one:

  1. It will only generate *.CAB files, even if you try to rename the settings, it will always generate a *.CAB file, but more importantly...
  2. It doesn't allow you to create subfolders in your *.WSP which localized deployments require.

Your other option is to get the Microsoft Cabinet SDK that includes the MakeCAB.EXE utility, craft a diamond directive file (*.DDF), and build the *.WSP that way. Yuck… there must be an easier way!

Overview

There is! With just a little work, you can configure your Visual Studio 2005 project, using MSBuild and MakeCAB.exe, to create the *.WSP file for you. Tony's post on how he did it to deploy a WSS v3 Feature shows one way to do this... I implemented a similar setup.

The process is actually quite simple. You'll create a new MSBuild targets file (basically an instruction file) that will execute the MakeCab.exe, passing in a DDF. You'll also need to create the DDF file that tells MakeCab.exe what it needs to build a CAB. Then you tell MSBuild that after it compiles the project, it needs to kick off the new targets file you created.

Prerequisite

You need to download and extract the Microsoft Cabinet SDK to your dev machine where you'll build this project. I extracted the contents of the SDK to c:\Program Files\Microsoft Cabinet SDK, but you can put yours anywhere you like (just make sure to make the appropriate changes to the custom targets file in step 5 below.

Modifying Visual Studio 2005 Projects to generate WSS v3 Solution Packages (*.WSP's)

In this article I'll walk through creating a simple feature that provisions a master page and preview image into the Master Page Gallery in a Publishing site. Steps 1-3 are nothing special… steps 4-6 utilizes the MakeCab.exe utility by leveraging MSBuild. It's these latter steps (4-6) that I consider customization steps… but it's only three steps!

Step 1 - Create a Visual Studio 2005 C# empty project

I'm not going to detail this step, here… all I've done is create a new Visual Studio 2005 project using the Empty Project template as shown in Figure 1.

VSEmptyProjectDialog
Figure 1 - Visual Studio 2005 Add Project Dialog

Step 2 - Add all files necessary for the feature

Nothing special here, just everything that you'll need for your feature. I just copy everything within the feature directory into the root of the project, then add them one by one to the project as existing items. You should how have a feature that looks like Figure 2.

SolutionWithFeature
Figure 2 - Project containing feature files

Step 3 - Add a Manifest.XML file to the project

When you deploy your solution it must contain a manifest.xml file detailing everything that's in the WSP file. Since my feature is quite simple, my manifest file is quite simple as well as shown in Figure 3:

ManifestXml
Figure 3 - Manifest.xml

Step 4 - Create a diamond directive file (*.DDF)

These are similar to *.INF files. DDF files are broken down into two parts: setting some variables and specifying the payload of the generated cabinet file. For all my DDF's, I use the same top part, up to the line of asterisks (a comment line). Next comes the payload.

Two things to note here: (1) files are relative to the current directory (the way I've set this up, it will always be the root of the project) and (2) when you want to create a subdirectory within the generated cabinet file, you need to set the DestinationDir variable. All files following that statement will be added to that subdirectory. Refer to Figure 4 to see the DDF file for our feature.

DDF
Figure 4 - SharePointFeaturePackage.ddf

Step 5 - Add custom MSBuild targets file

Now we need to create the instructions that we'll feed MSBuild to execute MakeCab.exe to generate our cabinet file. The first piece to this is in the opening node. It tells MSBuild the default target to run (which we'll define in a moment). Next, it creates a custom property called MakeCabPath which contains the path to the MakeCab.exe utility.

Now for the meat & potatoes: the custom MSBuild targets instructions. You'll see two nodes which will execute one command each when we build our project. The first one calls MakeCab.exe passing in three parameters:

  • DDF file: This is the instruction set for MakeCab.exe we created in the previous step. MakeCab.exe uses this to create the payload of the cabinet file.
  • CabinetNameTemplate: This tells MakeCab.exe what to name the output cabinet file. This isn't something you can do with Visual Studio's CAB Project template!
  • DiskDirectory1: This tells MakeCab.exe where to put the generated cabinet file.
Refer to Figure 5 for the custom targets file. A few things to note here:
  • I'm running MakeCab.exe a second time if you build using the Debug configuration (note the Condition attribute on line 13). This time, I build the cabinet but as a *.CAB file, not as a *.WSP file. Why? Because you can double-click into a *.CAB file in Windows Explorer to see its contents (good for debugging).
  • All output is saved to the $(OutputPath)SpPackage directory. This will result in a SpPackage folder being created in the bin\debug or bin\release folder depending on which Configuration you build under.

    Targets
    Figure 5 - SharePointFeaturePackage.Targets
    (don't include the wrapping of the Exec in your Targets file, I did it here for readability only)

Step 6 - Modify project file to import & call custom targets file after building the project

Finally, the last step is to configure your project file so that MSBuild will run our instructions in our custom targets file instead of the default instructions. To do this, you need to unload the project by right-clicking it in the Solution Explorer tool window and selecting Unload Project (refer to Figure 6). Now, right-click the project again in Solution Explorer and select Edit [project name].csproj. Make the following changes:

UnloadProject
Figure 6 - Unloading a project

  • Change the DefaultTargets attribute in the opening node from Build to SharePointFeaturePackage.
  • On (or about) line 31, change the node's Project attribute to SharePointFeaturePackage.Targets. This tells MSBuild to use our targets file, not the Csharp targets file (usually used for compiling).
Refer to Figure 7 for what your project file should look like. Save your changes, then right-click the project in the Solution Explorer window and select Reload Project (if prompted with a security warning, select Load project normally).

ProjectFile
Figure 7 - Customized project file (*.csproj)

That's it! Now build your solution. When you look in your \bin\debug\SpPackage directory, you'll see two files, a *.CAB and a *.WSP. Use STSADM.EXE to add the solution to the solution store using the following command at a prompt:
STSADM -o addsolution -filename ACsFileProvisioningFeature.wsp

With your solution added to the solution store, you now need to deploy it. You can do that from the command line, or by going to Central Administration, selecting the Operations tab, then Solution Management under the Global Configuration section. Select your solution then click Deploy Solution. Once it's deployed, you should see your feature in the [..]\12\TEMPLATE\FEATURES directory.

Finally, browse to a Publishing site, select Site Actions -> Site Settings -> Modify All Site Settings, then select Site Collection Features under the Site Collection Administration and click Activate for your feature (in my case, it's called File Provisioning Feature Sample 1) to provision the files. Check the Master Page Gallery (Site Actions -> Manage Content and Structure, then select Master Page Gallery) and you should see your custom master page in the list as shown in Figure 8. Very cool!

MasterPageGallery
Figure 8 - Provisioned File!

You can download the project I used in writing this article here: ACsFileProvisioningFeature.

Extras

 [Update 5/1/2008 @ 730a] I now have a Visual How To screencast on MSDN demonstrating the same process: http://msdn2.microsoft.com/en-us/library/cc441431.aspx

posted on Wednesday, December 20, 2006 9:56 AM

Feedback

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 1/30/2007 2:37 PM TSC
Gravatar Great Post !
swimming into the cab files.... and I found it!

thank you

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 12/21/2006 8:45 AM Renaud Comte
Gravatar This is definitely a super post

I just test it and blog about it

As i found also some issues, i've posted also the different fixes i found

http://blog.spsclerics.com/archive/2006/12/21/219898.aspx

Good work mister MVP

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 12/21/2006 12:09 PM AC [MVP MCMS]
Gravatar Renaud - I'd argue that's not a "fix" that you mention in your post. Rather, that's a configuration nuance in Visual Studio 2005 that has nothing to do with my solution. It's something that needs to be turned on in order to see the project unload/load options.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 12/22/2006 10:42 AM Renaud Comte
Gravatar Totaly agree with you
It's why i rename my post :)



# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 1/4/2007 4:12 AM Anders Rask
Gravatar Hi,

nice post, but whats the added bonus compared to just use post build events to call makecab /f myproj.ddf ?

If none, using MSBuild just seems an added complexity to me :-o


# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 1/4/2007 9:31 AM AC [MVP MCMS]
Gravatar Anders - Good question. After you make your changes to the post build event, look at the source of the CSPROJ file... at the bottom you'll see VS is calling your post build event using MSBuild. Better to use a more extensible solution in MSBuild than DOS commands. With that being said, no reason to switch if you don't want to.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 2/13/2007 6:50 AM Owe
Gravatar Hi,
thanks for an interesting article. I downloaded your project zip file and tried to compile and deploy as you explained.

Building proceeds without errors and I find the .wsp and the .cab file as expected. But when I trie to install throught stsadmin.exe it says:
"Required tag 'WebPartManifest' is missing from XML file 'acsfileprovisioningfeature.wsp', found 'Elements' instead"

Am I missing something obvious or?

Another thing I've noticed is that the Manifest.xml in the zip is not the same as in the screendump in this article. Maybe this is the problem?

Thanks again.



# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 2/13/2007 8:38 AM AC [MVP MOSS]
Gravatar Owe - No, there's a mistake in the ZIP. Someone told me about it earlier and I just forgot to update the file. Give it a try now.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 2/16/2007 8:34 AM Owe
Gravatar Thanks, Andrew. Work like a charm!

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 2/22/2007 11:31 AM Carlos Lopez
Gravatar Guys, is there any way to avoid overwrite some useful files in the solution, I mean when you update a solution???

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 2/22/2007 12:56 PM AC [MVP MOSS]
Gravatar Carlos-
I don't understand your question.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 3/22/2007 9:29 AM Kaisa
Gravatar Will deploying the solution also install the feature? It didn't when I deployed it. If that's how it's supposed to be, you might want to mention it in your post. Everything else was reasonably easy to understand, but having to install the feature myself confused me.
Anyway, it works very well now, so thanks for sharing. :)

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 3/22/2007 9:48 AM AC [MVP MOSS]
Gravatar Kaisa-
Deploying the solution installs the feature, but it doesn't activate it. This is by design.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 4/3/2007 1:57 PM Mike Parrill
Gravatar Andrew,

Great solution, but I have a suggestion:

Instead of changing the DefaultTargets attribute in the Project Node to SharePointFeaturePackage, you should change it to "Build;SharePointFeaturePackage". This way it still does the c# build to make sure that the project does build properly. Then instead of changing the import node at the bottom, you can just add another node that points to the SharePointFeaturePackage.Targets and you would have the following:

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="SharePointFeaturePackage.Targets" />


# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 4/5/2007 7:18 PM Pankaj
Gravatar This is great. One additional question...Can you achieve configuration of quick launch items, adding selected web parts to pages, etc. using this? OR for that do I have to do these steps manually post the activation of the feature? I would love to have all done by an install like this instead of amanula one as that provides a scope for issues to creep in deployment.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 4/5/2007 10:40 PM AC [MVP MOSS]
Gravatar Pankaj-
You can't change items in the QuickLaunch via a feature directly, but you could using a feature receiver. Same deal with Web Parts. You don't have to do them manually... you can do some of it via the SP API.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 4/5/2007 10:48 PM AC [MVP MOSS]
Gravatar Mike-
But the point in this one was to not build the project, simply use it as a container for a MSBuild project. You're right, if I wanted to build it, your method would work. However, I actually prefer to use the <AfterBuild> node in the project file.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 4/6/2007 1:23 AM Pankaj
Gravatar Thanks. Will try this...

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 4/12/2007 10:33 AM Todd
Gravatar A bit outside the scope of this article, but a question on solution files...

We have the need to deploy .cab files to the server via our solution deployment. However, when doing so we get an error: "Failed to extract the cab file in the solution."

I've traced this down to specifically having a .cab file in the solution.

Is there a way to work-around this problem and just have these files deployed as any other files in the solution?



# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 4/15/2007 12:09 AM AC [MVP MOSS]
Gravatar Todd-
A CAB within a CAB? If that's what you're asking, I've never tried it.

# Error while building the solution 4/20/2007 7:43 AM Janakiraman C
Gravatar Hi,

Can resolve my issue I get an error msg when I compile the solution after following all the steps. The error is The command “c:\cabsdk\bin\makecab.exe /F SharePointFeaturePackage.ddf exited with code 1”.

Tell me the resolution....



# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 4/20/2007 9:59 AM AC [MVP MOSS]
Gravatar Janakiraman-
Look at the output window and see what the real error is to troubleshoot. Code 1 is a general error that tells you nothing.

# Error while building the solution 4/23/2007 1:16 AM Janakiraman C
Gravatar Thanks...

How to add .stp files to solution. I have saved my site modification as template and use this (.stp) while deploying solution to new web application in WSS.
And also tell me how to add images, web parts (dlls) and its entry in web.config file.

So, tell me how to perform this task.

# Creation of wsp solution 4/26/2007 12:49 AM Janakiraman C
Gravatar Hi,

I have added xml file using SiteDefinitionManifests element of manifest file as

<SiteDefinitionManifests>
<SiteDefinitionManifest Location="STS">
<WebTempFile Location="1033\STS\demotemp.XML"/>
</SiteDefinitionManifest>
</SiteDefinitionManifests>

and add the images in images folder using element (TemplateFiles) as
<TemplateFiles>
<TemplateFile Location="1033\images\email.gif"/>
</TemplateFiles>

Tried to add the wsp file to SP solution store.
It populates an error msg "Cannot find the file specified in the manifest file: 1033\STS\demotemp.XML"
I am getting the same error for (TemplateFiles) & (SiteDefinitionManifests).

Rectify whether license key can acheived using solution package or not.

Guide me how to resolve this issue...

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 4/26/2007 6:58 AM AC [MVP MOSS]
Gravatar Janakiraman-
The problem is the WSP file you're creating doesn't mimic the same folder structure as your target location.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 4/26/2007 7:29 AM Janakiraman C
Gravatar Hi,

I created a solution with empty project and followed the above steps when I try to compile the project. An error msg is populated -- "CS5001: Program 'D:\Packages\SampleSolutions\SampleSolution\obj\Debug\SampleSolution.exe' does not contain a static 'Main' method suitable for an entry point.

Guide to resolve this issue...



# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 4/26/2007 8:06 AM Janakiraman C
Gravatar Hi,

I have created (.wsp) file in my server and tried to add that solution in my server itself. But yet it populates an error msg "Cannot find the file specified in the manifest file: 1033\STS\demotemp.XML". Target path is exactly the same as what I have given in (.wsp)

Guide to resolve this issue...


# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 4/28/2007 9:52 AM AC [MVP MOSS]
Gravatar Janakiraman-
You didn't change the project file as I outlined in the directions... MSBuild is trying to compile the project.

As for the WSP error, that simply can't be the case that the paths are the same, or you wouldn't be getting the error message. Not possible to debug without seeing the solution. Please post to the dev/customization SharePoint newsgroup.

# Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 5/4/2007 1:32 AM Janakiraman C
Gravatar Hi,

Great Stuff for solution package.

I have created .wsp file for site definitionand deployed it to my url successfully. After the deploy I tried to open my Url. It displays an error msg ("An error occurred during the compilation of the requested file, or one of its dependencies. Cannot convert type 'Microsoft.SharePoint.WebControls.DelegateControl' to 'System.Web.UI.IAttributeAccessor'").

Can U guide me how to resolve this err.

Thanx...


# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 5/8/2007 3:57 PM Matt
Gravatar Andrew,

Is it possible to apply this deployment method for custom workflows, and webparts created in VS 2005. I see in the documenteation that web parts parts are mentioned but I dont see anything about custom workflows created in VS 2005.

Thanks,

Matt

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 5/8/2007 4:03 PM AC [MVP MOSS]
Gravatar Matt-
Workflows are deployed using Features, then you use this method to deploy the Feature.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 5/10/2007 7:41 AM Narasimha
Gravatar
I have struck up with the following error..

Any help please?

Error 2 The command " /F SharePointFeaturePackage.ddf
/D CabinetNameTemplate=AcsFileProvisioningFeature.wsp
/D DiskDirectory1=bin\Debug\SpPackage\" exited with code 9009. AcsFileProvisioningFeature



# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 5/10/2007 9:43 AM AC [MVP MOSS]
Gravatar Narasimha-
That's the general error code... look at the output window for a detailed error.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 5/11/2007 7:09 AM Kishan
Gravatar Hi,

How to add .xml or .resx files to solution and deploy to SharePoint site virtual directory?

Thanx

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 5/15/2007 3:50 PM Matt
Gravatar Andrew,

After literally pulling all of my hair out I finally understand what my problem is. I have successfully downloaded your SPJobDefinition file andwas able to compile and deploy the .wsp file. I am also able to create a project from scratch and follow your step in this article and get my own JobTimer to deploy corretly. My problem is after I initially build and deploy the project, I can not figure out how to change any part of my code, and rebuild and redeploy my project to reflect those changes. I deactivate the feature, retract the solution, remove the .wsp from the store, copy the new .wsp file and add it to the store. No matter how I deploy it I cannot get the chnages to show. Absolutely killing me...

Any suggestions?

Thanks again your a job saver!!!

Matt


# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 5/15/2007 6:12 PM AC [MVP MOSS]
Gravatar Matt-
Sometimes you need to reset IIS to get the GAC to be refreshed as your changed assembly is being deployed to the GAC.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 5/29/2007 9:35 PM Adam
Gravatar Hi Andrew,

Thanks for another great post. You are plugging some very large gaps in the documentation!

I had the same problem as Kaisa - your sample solution deployed and created the Feature folder on the server but did not install the feature.

I found it worked if I added a FeatureManifests element to the Manifest.xml, i.e.:

<FeatureManifests>
<FeatureManifest Location="ACsFileProvisioningFeature\Feature.xml"/>
</FeatureManifests>

- with this in the file the feature is automatically installed but not activated when the solution is deployed.

Thank again,
Adam


# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 5/29/2007 10:07 PM AC [MVP MOSS]
Gravatar Adam-
That's correct... the way the manifest file is written, no feature is installed because I didn't use the <FeatureManifest> option in the solution... rather I just copy files into the site. A complete solution would be to create the <FeatureManifest> section in the manifest.xml file as you show in your comment, I just haven't gotten around to updating the code or the article. :)

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 5/30/2007 7:02 AM Frank van Rooijen
Gravatar I had the same 9009 error. My problem originated in the file: SharePointFeaturePackage.Targets. In the command tag of the Exec node, I copied the enters and the tabs from the example. After removing these enters and tabs the solution worked fine for me.

Hope this helps.

Kindregards,
Frank

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 5/30/2007 8:10 AM AC [MVP MOSS]
Gravatar Frank-
The picture in the article states the same thing, that I added those just for readability.

# Everything seems to work fine, but... 6/4/2007 2:15 PM Collin Ames
Gravatar Using your example, I created my own feature for a new master page and the css and image files that support it. Everything seemed to work fine right up through deploying it in Operations/Solution Management; however, when I go to a site and look for it in Site Collection Features, it is not listed.

Any ideas on what I should be looking for to see what went wrong?

Thanks

# Follow-up 6/5/2007 10:27 AM Collin Ames
Gravatar I should have noted in the previous e-mail that the sample feature package you provided also did not show up in the site collection feature list when I deployed that.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 6/12/2007 4:15 PM RJ
Gravatar Great article. I got the solution to build, and deployed it successfully, but when I try to activate it on a site, I get the following error: "The solution contains no Web application scoped resource, and therefore cannot be deployed to a particular Web application. It can only be deployed globally." Any input?

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 7/4/2007 7:11 AM Gonzalo Santacruz
Gravatar Hi,

Good post that helped me with deploying content types.
But...questions:

Each time I want to update content types from development environment to Production Front Ends, must create manually the ContentType.xml files?? If I have 30 content types with it's Columns (15 each)...Should I have to find (from querystring, i.e.) each GUID to make the xml file???

Is it possible to make it easier?

One more question:
If I deactivate the deployed feature (with it's content types and columns) on Production environment, what happens with the contents or layouts using those content types?? (even if I deploy a newer version and activate it)

Thanks in advance,
Gonzalo

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 7/4/2007 10:52 AM AC [MVP MOSS]
Gravatar Gonzalo-
I totally agree... it's tedious to build them today. So I did something to make your life easier. It's a work in progress, but I include the source to feel free to tweak: http://andrewconnell.com/blog/articles/MossStsadmWcmCommands.aspx

For your other question, by design, content created by the activation of a Feature, like masters, page layouts, content types, and site columns... that content is generally not cleaned up on Feature deactivation. This is by design. To get around it, write a Feature receiver that handles the deactivation event to clean up the old content.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 8/8/2007 5:12 AM Sergey
Gravatar Hi,
Thank you for your articles.
I have a number of questions:
1. CustomSiteMapProvider is part of sps solution. Is there a way to set for it a key in web config?
2. How can i associate my custom page layout with an existing content type so, that the layout remains to be ghosted (uncustomized):
a) by instalation - is there a way to associate it with CT Name(not ID)?
b) by sps administration
3. Haw can i see if my layout is ghosted(uncustomized) or not?
4. Is there a way to restore the layout to be "ghosted"?

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 8/8/2007 5:40 AM Sergey
Gravatar Hi,
One more question about "create new page":

Is there a way to filter layout list? I would like to see only layouts, that are associated with the content types related to the current "Pages" list.

Thanks

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 8/8/2007 9:18 AM AC [MVP MOSS]
Gravatar Sergy-
Not sure what you mean about setting a key for CustomSiteMapProvider. If it's part of the MOSS assemblies, then you'll need MOSS installed. To associate a page layout with a content type you need to use the PublishingAssociatedContentType property in the Feature. You can see if a file is customized by looking at it in SPD or checking the SPFile.CustomizedPageStatus. You can revert it back to the uncustomized state using SPFile.RevertToContentStream or by usng the "Revert to site definition" options in the Site Settings page or SPD. As for filtering, you can filter on a site by site basis using a link in the Look & Feel column of site settings (I think... doing that from memory).

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 8/9/2007 4:51 AM Kalpesh
Gravatar This is task can be done by VS.NET 2005 extension for WSS.
But unfotunetily after creating that files it deploys to site!!!

Is there way to get WSP file created by by VS.NET 2005 extension for WSS?

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 8/9/2007 11:31 AM AC [MVP MOSS]
Gravatar Kalpesh-
Kinda... as your question implies, the VSeWSS tools hide the actual creation of the WSP which I hate (along with a TON of other things about the VSeWSS which are horribly implemented and I recommend everyone stay away from them until we see another update).

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 8/13/2007 9:48 AM Jacqueline
Gravatar I am trying to create a CAB file without success. The error message is as shown below. I am created all files NOT directly on the machine which houses the MOSS. I map the drive and copy the files that need to exist in order to deploy a solution. Unfortunately, I'm not quite sure what to do with the CAB file. Does it need to be copied to a folder on the machine which houses the MOSS also (K:/ in this instance)? I did update the ddf file to reflect this but I'm not sure that it is correct. Any help you can give me would be much appreciated.

Code from WSP.ddf file:
;WSP CAB Generation (lines beginning with semicolon are comments)
.Set DiskDirectory1="k:\wsp"
;DiskDirectory1:Output folder for the CAB. Set to "k:\wsp" to keep it simple"
.Set CabinetNameTemplate="Alternate Page Header.wsp"
;CabinetNameTemplate:name of output file. This name will show in the WSS v3 sln store.

;All file reference should be from the project root

;Files to place into the CAB root
manifest.xml

;Files to place into the folder AltHeader
.Set DestinationDir="AltHeader"
12\TEMPLATE\FEATURES\AltHeader\Feature.xml
12\TEMPLATE\FEATURES\AltHeader\Elements.xml

;Files to place into the folder CONTROLTEMPLATES
.Set DestinationDir="CONTROLTEMPLATES"
12\TEMPLATE\CONTROLTEMPLATES\AltHeader.ascx

Build results:
------ Build started: Project: AltHeader, Configuration: Debug Any CPU ------
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /debug+ /debug:full /optimize- /out:obj\Debug\AltHeader.dll /target:library Properties\AssemblyInfo.cs

Compile complete -- 0 errors, 0 warnings
AltHeader -> D:\Visual Studio\AltHeader\bin\Debug\AltHeader.dll
cd ..\..\
xcopy "12" "K:\Program Files\Common Files\Microsoft Shared\web server extensions\12\" /e /y
makecab /f WSP.ddf /d /y
12\TEMPLATE\CONTROLTEMPLATES\AltHeader.ascx
12\TEMPLATE\FEATURES\AltHeader\Elements.xml
12\TEMPLATE\FEATURES\AltHeader\Feature.xml
12\TEMPLATE\FEATURES\AltHeader\Manifest.xml
12\TEMPLATE\FEATURES\AltHeader\WSP.ddf
5 File(s) copied
Microsoft (R) Cabinet Maker - Version 5.1.2600.2180
Copyright (c) Microsoft Corporation. All rights reserved..

ERROR: Could not find file: WSP.ddf
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(3089,13): error MSB3073: The command "cd ..\..\
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(3089,13): error MSB3073: xcopy "12" "K:\Program Files\Common Files\Microsoft Shared\web server extensions\12\" /e /y
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(3089,13): error MSB3073: makecab /f WSP.ddf /d /y" exited with code 1.
Done building project "AltHeader.csproj" -- FAILED.
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========

Thank you in advance.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 8/13/2007 11:16 AM AC [MVP MOSS]
Gravatar Jacqueline-
MakeCab.exe can't find the DDF file. It is expecting it to be in the same place where makecab is, or where it is running from.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 8/13/2007 4:27 PM Jacqueline
Gravatar Should the DDF file exist in the same location as MakeCab.exe?

I've tried to rebuild the solution again.

When I try to make the CAB file manually from the server, I receive the error as shown below:

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE
\FEATURES\AltHeader>makecab.exe /f WSP.ddf
Microsoft (R) Cabinet Maker - Version 5.2.3790.0
Copyright (c) Microsoft Corporation. All rights reserved..

Parsing directives (WSP.ddf: 1 lines)
WSP.ddf(12): ERROR: Could not find file: 12\TEMPLATE\FEATURES\AltHeader\Feature.
xml
WSP.ddf(13): ERROR: Could not find file: 12\TEMPLATE\FEATURES\AltHeader\Elements
.xml
WSP.ddf(17): ERROR: Could not find file: 12\TEMPLATE\CONTROLTEMPLATES\AltHeader.
ascx
ERROR: MakeCAB aborted: 3 errors encountered

Could it be that the folder address is truncated?

12\TEMPLATE\... is the folder structure I used when creating the solution in visual studio.

The actual location would be:

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\...

Should this be updated in the DDF file? I did try it and it didn't work. Thank you very much in advance.


# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 8/13/2007 4:49 PM AC [MVP MOSS]
Gravatar Jacqueline-
Now that's a different error because now it can see the DDF file. The DDF file tells MakeCab.exe where to find the files. If you put relative links to the files (as you did), it is going to assume it is starting from the path where makecab.exe was executed from (not from where makecab.exe is, but where you were when you ran it). A way around this is to put the full path, but that's a bad idea as it isn't very portable.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 8/22/2007 6:45 AM Damien
Gravatar I am trying to extend this to add in custom content types but am struggling with an error 'out of range' when trying to activate the feature. Has anybody extended this to include custom content types and willing to post an example?

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 8/22/2007 9:58 AM AC [MVP MOSS]
Gravatar Damien-
Post the portion of your elements.xml file that creates the content type. This process certainly works for custom content types.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 8/23/2007 11:18 AM Damien
Gravatar I added the following to the feature.xml:
<ElementManifest Location="Elements.xml" />
I used the output from the STSADM.EXE -o GenContentTypesXml command as per your other excellent post in the element.xml file. If anything extra needed adding to the output generated from that then i will be missing it!

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 8/24/2007 10:56 AM Damien
Gravatar <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ContentType ID="{0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39000EB6329C9F81F148AABA1205C4D49FE4}" Name="BasePage" Description="" Group="Capita" Version="0" Sealed="False" Hidden="False" ReadOnly="False">
<FieldRefs>
<FieldRef ID="{c042a256-787d-4a6f-8a8a-cf6ab767f12d}" Name="ContentType" DisplayName="Content Type" Required="False" />
....


# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 8/24/2007 11:12 AM AC [MVP MOSS]
Gravatar Damien-
I'd guess the field you're referencing doesn't exist. Check the MOSS error logs for hopefully more detail. Sorry... debugging Feature is not easy.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 9/4/2007 7:26 PM mpalmer
Gravatar Hello Andrew,
I'm going over a very similiar article that you put together for Telerik (http://www.telerik.com/documents/MOSS_whitepaper.pdf).
Problem is that when I try to create the .WSP file (step 11, page 9) I get the following error:
The command ""C:\Program Files\Microsoft Cabinet SDK\BIN\MAKECAB.EXE" /F TelerikSkins.ddf /D CabinetNameTemplate=Telerik.RadEditor.wsp /D DiskDirectory1=wsp" exited with code 1.

The reason is that it cannnot locate the DDF file.
So - I'm wondering if there is a to tell MakeCab.exe or Visual Studio or MSBuild to look for paths realtive to the project file ?

Heres the csprof file in edit mode (any ideas would be greatly appreciated)
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{79F61B30-86F8-4684-ABB2-AB0C9A09D485}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Telerik.RadEditor</RootNamespace>
<AssemblyName>Telerik.RadEditor</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<MakeCabPath>"C:\Program Files\Microsoft Cabinet SDK\BIN\MAKECAB.EXE"</MakeCabPath>
</PropertyGroup>
<ItemGroup>
<Content Include="manifest.xml" />
<Content Include="RadEditor.Net2.dll" />
</ItemGroup>
<ItemGroup>
<None Include="TelerikSkins.ddf" />
</ItemGroup>
<ItemGroup>
<Folder Include="wpresources\RadControls\Menu\Skins\" />
</ItemGroup>
<Target Name="Build">
<Message Text="$(MakeCabPath) $(MSBuildProjectDirectory)" Importance="high" />
<Exec Command="$(MakeCabPath) /F TelerikSkins.ddf /D CabinetNameTemplate=$(MSBuildProjectName).wsp /D DiskDirectory1=wsp" />
</Target>
</Project>

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 9/4/2007 7:45 PM AC [MVP MOSS]
Gravatar mpalmer-
The exit code 1 doesn't tell you anything except MakeCab had a problem. Look at the output to see the actual error from MakeCab.exe.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 9/11/2007 12:25 PM Mark Wagner
Gravatar Excellent post! Well written.

# Help Required for programmatically accessing content editor webpart 10/12/2007 9:05 AM Taha
Gravatar Hello,
I need to access the content editor webpart's content and mail the same.
can u plz tell the approach to the same?
I guess the possible solution will be to access it programmatically and email the content...
but i m not able to refer to the page's webparts in general and content editor webpart in particular programmatically(by which i mean sharepoint object model)...
Help required !!!


# Deploy webpart to Particular site collection of Web application in Sharepoint 10/18/2007 2:41 AM JanakiramanC
Gravatar Hi hello,

My requirement is to deploy webpart to particular site collection of web application.
I have created web part using user control and deploying user controls dll to bin of web application and web part dll to GAC. Need help or different approach how to Deploy webparts to Particular site collection.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 10/18/2007 7:46 AM AC [MVP MOSS]
Gravatar Janakiraman-
You need to deploy the Web Part definition to the Web Part Gallery for the site collection.

# Deploy webpart to Particular site collection of Web application in Sharepoint 10/19/2007 12:56 AM JanakiramanC
Gravatar Hi,

Can you just help me out how to deploy web part definition to Web Part Gallery for the site collection using wsp file.


# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 10/19/2007 9:13 AM AC [MVP MOSS]
Gravatar JanakiramanC-
Look at provisioning the file using a Feature and the <module> site element. Refer to the SDK for some good examples (and plenty if you search the web & forums).

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 10/19/2007 9:50 AM Joakim
Gravatar Hello,

I tried to make a .wsp following your steps, and I succeeded.

It turns out I want to make changes to my code after the solution is generated though. And the dll I tell makecab to pick up in the .ddf is never rebuilt after I made the target changes to the project file.

Do I have to change my project back to the way it was target-wise originally, make my changes and then change back and generate the solution or is there a shortcut I can take?

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 10/19/2007 1:30 PM AC [MVP MOSS]
Gravatar Joakim-
If you had updates, just run STSADM with the UPGRADESOLUTION to update and redeploy the solution after rebuilding it to generate a new WSP.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 10/22/2007 11:07 AM Joakim
Gravatar Thank you for the reply.

After I posted I realised that I'm experiencing the same thing 'Matt' did in a comment from May.

I haven't tried the upgradesolution yet, but I will.

I'm suspecting that what I'm experiencing has something to do with the GAC holding on to my original assembly though.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 11/22/2007 8:33 AM Nirav
Gravatar I am facing below error while doing as per your instruction. Please help me out


Error 1 The command " /F SharePointFeaturePackage.ddf
/D CabinetNameTemplate=Project1.wsp
/D DiskDirectory1=bin\Debug\SpPackage\" exited with code 9009. Project1


# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 11/22/2007 9:15 AM AC [MVP MOSS]
Gravatar Nirav-
That doesn't really help. As the other comments have indicated above, you should look at the Output window to get the real error.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 12/13/2007 9:30 AM Andre Mulder
Gravatar Hi Andrew, nice post.
I'm trying to deploy my feature, but i'll get an error while deploying. The error is:

Feature 'c8dd9730-7c72-412c-b02c-a5ff07465e06' could not be installed because the loading of event receiver assembly "AndrewConnell.TaskLoggerJob, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3ea963572cf8544f" failed: System.IO.FileNotFoundException: Could not load file or assembly 'AndrewConnell.TaskLoggerJob, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3ea963572cf8544f' or one of its dependencies. The system cannot find the file specified.
File name: 'AndrewConnell.TaskLoggerJob, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3ea963572cf8544f'
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Can you help me to fix this error?

Thanks

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 12/14/2007 9:52 AM Andre Mulder
Gravatar Hi,

i'm getting an error while deploying and i don't know what it means. Who will help me with this error?

Failed to create feature receiver object from assembly "TaskLoggerJob, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3ea963572cf8544f", type "TaskLoggerJob.TaskLoggerJobInstaller" for feature 4b59316a-4949-4b3e-ab51-d914034e671c: System.ArgumentNullException: Value cannot be null.
Parameter name: type
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject()

Thanks,
Regards Andre mulder

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 12/15/2007 9:22 AM AC [MVP MOSS]
Gravatar Andre-
Looks like the assembly containing the Feature receiver didn't get deployed to the GAC. Look in the GAC and see if it is there. If it is, then you should attached a debugger to your Feature's activated event to see where the error is occuring.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 1/24/2008 3:11 PM Nadeem
Gravatar Error 1 The command ""C:\Program Files\Microsoft Cabinet SDK\BIN\MAKECAB.EXE" /F BuildSharePointPackage.ddf /D CabinetNameTemplate=Xell.MovePrivateItemsJob.wsp /D DiskDirectory1=bin\Debug\SpPackage\" exited with code 1. Xell.MovePrivateItemsJob

Could you guys tell me what the problem is?

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 1/25/2008 12:42 AM AC [MVP MOSS]
Gravatar Nadeem-
Please read the comments in this post as this is explained a few times.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 1/25/2008 9:22 AM Fred
Gravatar I have a similar problem and have checked the output window which states the following:


Parsing directives (deploy.ddf: 1 lines)

deploy.ddf(1): ERROR: Could not find file: ´╗┐
ERROR: MakeCAB aborted: 1 errors encountered


I have absolutely no clue why, very strange characters involved there: "╗┐". The beginning of my ddf looks just like yours except for a comment above the first line like this ";comment", but I've tried to remove it without success...
Any ideas?


# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 1/25/2008 9:30 AM Fred
Gravatar This is Fred again, I found the solution to my own very special problem which I posted just a few minutes ago. Seems my .ddf-file which I actually had copied from another entirely different solution was somehow corrupted. I deleted it and added a new item -> text file which I named the same. Then I copied the content back in and it worked...strange..

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 1/28/2008 5:05 PM DKF
Gravatar I would think with all the comments written here that you could figure out that your instructions are confusing. It seems that half the steps are lacking in detail. I am looking for someone elses solution as yours is not clear.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 1/28/2008 5:28 PM AC [MVP MOSS]
Gravatar DKF-
I've had a few people who have had challenges, but if you look they are all almost going back to the same issue with the whole "exited with code 1" issue, which IMHO, had people read the comments, they would have fixed it pretty quick seeing the answer over and over.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 4/17/2008 2:03 AM Ashleigh Green
Gravatar I just wanted to say that I've found this article really useful. Also reading through all of the comments helped me avoid a number of issues other people have had, so thanks for taking the time to go through all of this with everyone in so much detail.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 4/17/2008 12:43 PM AC [MVP MOSS]
Gravatar Ashleigh-
Thanks for that feedback. I withed people would look at the comments a bit more as the dialog is very valuable.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 5/10/2008 6:40 AM Jamil Haddadin
Gravatar nice post, you are the best!

# Using Flicker - all your pictures are blocked 5/15/2008 7:04 PM Badajoz
Gravatar Btw, flicker is not a great photo store as it is often blocked by firewalls (all your pictures are blocked), especially in paranoid public service organisations ... thanks for the post though, something to mull over at home :)

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 5/15/2008 9:39 PM AC [MVP MOSS]
Gravatar Badajoz-
Sorry to hear that. Yours is the first complaint, but its good to have that info as I plan out the next implementation of my blog.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 5/21/2008 4:35 AM Aidan
Gravatar Thanks for the great post! I have used it to deploy a page layout. I then extended it with a SPFeatureReceiver to remove the layout on FeatureDeactivating.
However, when the code gets to file.Delete() I get an error saying the item is referenced by other pages - I have checked and it is not. The only fix for this I have found is to manually move the file in SharePoint Designer and then delete it. Obviously this is not a great solution - do you know of a better way?
Thanks,
Aidan

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 5/21/2008 1:39 PM AC [MVP MOSS]
Gravatar Aidan-
I've seen this... and I just don't have an answer for it.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 5/26/2008 8:36 AM Jeremy Thake
Gravatar I've also been doing some articles on this topic that you may find interesting... http://wss.made4the.net/archive/2008/05/26/solution-development-in-sharepoint-2007.aspx

Be interested to hear your thoughts...

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 6/3/2008 6:20 AM Kieran
Gravatar Andrew,

Do you also use visual studio to debug your web parts etc? It seems that if you have developed a custom web part, then yes, you can debug it but what if you have an issue with an OOTB web part and you need to debug an error.

Regards
Kieran

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 6/14/2008 7:30 AM AC [MVP MOSS]
Gravatar Kieran-
Your DDF file is not correct... you need to point to the relative folder in the WSP you are targetting.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 6/18/2008 8:01 PM AC [MVP MOSS]
Gravatar Notice to future commenters - please do not post any more DDF or manifest.xml files. I'm not going to approve these comments because it is not the place to debug issues related to specific packaging files.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 6/23/2008 10:17 AM Sigurbjorn
Gravatar Hi Andrew and thanks for this article.

I downloaded your sample project, compiled it and added the solution using STSADM to my site successfully. But the feature "File Provisioning Feature Sample 1" doesn't show up under "Site Collection Features".

Any thoughts on that.

Regards,
Sigurbjorn

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 9/15/2008 2:30 PM Rui Pinto
Gravatar Hi Andrew,

I've just got a litle problem with the makecab (i thnik the problem is there).
When i try to create de wsp file, it takes all the page layouts, css files and others but it changes the created date of that files for the modified date..

Any ideia why is this appening?

For example, in visual studio i modify abc.aspx file. When i generate the wsp the created date of abc.aspx file ( in .cab file) is changed by the modified date.. the fields are changed on for the other..

Regards,
Rui

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 9/19/2008 1:39 PM Sithender
Gravatar Hi Andrew,

Thanks for great Post.
Andrew I am getting error when i try to create solution file for my codebehind application.Can you pls help me in this regard.

I deployed my .dll in GAC .And gieven reference in manifest.xml and .ddf file.

However when i try to create .CAB file using .DDF i am getting error like
Could not find file:MyFirstCodeBehind.dll
And when i removed reference in .ddf and tried to create .CAB it is successfully created.
When i tried to add this .CAb file to solution usinfg STSADM tool ,now i am getting error in manifest
Cannot find this file specified in the manifest file:MyFirstCodebehind.dll


Can you pls tell me help me .why i am getting this error?



Regards
Sithender

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 9/19/2008 2:23 PM AC [MVP MOSS]
Gravatar Sithender-
The first error is in the DDF... it isn't pointing to the correct location of your DLL. The second error is because your WSP file does not include the DLL because you removed it.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 9/24/2008 4:26 PM Karthik
Gravatar Hi Andrew,

I was trying to follow your post to automate the wsp build using VS2008 and ran into this problem. When I added your code for the BuildSharePointPackage.targets, I got this warning for <MakeCabPath> :

Warning 1 The element 'PropertyGroup' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003' has invalid child element 'MakeCabPath' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'. List of possible elements expected: 'Property' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'.

Any idea why this happens? Am I missing any steps?

Thanks,
Karthik.


# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 9/24/2008 4:53 PM AC [MVP MOSS]
Gravatar Karthik-
Yup... that's expected. When you add <MakeCabPath>, that's like a variable name. It will never show as a valid element in the schema because the schema can't be written to expect a wildcard element. Just ignore it... it's expected. :)

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 9/24/2008 7:35 PM Karthik
Gravatar Hi Andrew,

Thanks for the reply! Yes, it does work now. But now the question that pops up for me is: will this work in TFS when it runs a build and will the wsp be placed in the drop location? Or do I have to modify the .csproj for TFS build?

Thanks,
Karthik.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 2/20/2009 3:25 PM Nancy
Gravatar Hi AC,
My .cab has successfully created.
I have a instal.bat file that contain addsolution as well as deploysolution:
However when It gets to addsolution, below is the error I get:

Error: Cannot find this file specified in the manifest file: TestTimerJob\feature.xml
TestTimerJob.wsp: The Solution installation failed.


and when it gets to deploysolution, below is the error I get:
"TestTimerJob.wsp" does not exist int he solution store.

Below is my featuremanifest within my manifest file:
<FeatureManifests>
<FeatureManifest Location="TestTimerJob\feature.xml" />
</FeatureManifests>

Going few steps back, here's what I did, after buiding the project sucessfully:
1. Create feature.xml under ..\12\TEMPLATE\FEATURE\TestTimerJob
2. create manifest file under project root
3. create .ddf under project root
4. makecab /f filename.ddf (Successfully created)
5. typying "install" in commad prompt

Any idea why? Am I missing a step or am I more stupid than I thought?
Thank you again for all your great article.


# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 2/22/2009 7:07 AM AC [MVP MOSS]
Gravatar Nancy-
When you add the solution to the solution store (via STSADM -o addsolution), it's telling you that it can't find the Feature. It should be in a subfolder off the root of the CAB named TestTimerJob\feature.xml. If you've put it in the cab nested down under 12\Template\Feature... then the path is different.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 2/23/2009 12:11 PM Nancy
Gravatar Thanks for the reply.
I have also added TestTimerJob\feature.xml to my project root.
I still get the same result!

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 2/23/2009 2:45 PM AC [MVP MOSS]
Gravatar Nancy-
Sorry, but it's hard to fix your issue like this. Rename your WSP to a CAB and double click on it. you should have a folder named TestTimerJob (not nested inside anything else) and a feature.xml file inside it.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 2/24/2009 8:19 AM Nancy
Gravatar AC,
Thank you so much for responding. You are just great.
I found the problem; Before, I built the cab where my .dll was located, which was under bin\debug.
This time I build the cab where my .dff was located, which was the project root.
That solved the problem.
Although it still doesn't make sense to me. Because even when I made the cab where my .dll was located, I map all the files (manifest, feature,..) correctly within my .dff.

Anyway, AC, I love your articles. I wouldn't have been abled to make a simple timer job if wasn't for your articles.
Thank you


# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 4/7/2009 10:12 AM Ryan
Gravatar Hi AC,

Thanks for this, I feel I'm making some progress, however I too am receiving an error similar to others when Building the solution.

------ Build started: Project: wspmasterpage, Configuration: Release Any CPU ------
C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\wspmasterpage\wspmasterpage\wspmasterpage.csproj : error MSB4057: The target "SharePointFeaturePackage" does not exist in the project.
Done building project "wspmasterpage.csproj" -- FAILED.
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========


Now, I may be getting confused a bit, the target "SharePointFeaturePackage", is this a destination folder or is a file that the solution is trying to source. My project is setup identically to yours, I have checked this several times, so is there something going on outside the project in another folder that I have overlooked? I am doing this in VS2008, does that make any difference? Also in the .targets file where you have typed (outputpath) is this where I am meant to type my own output path or is what? As you can tell, I'm pretty new to this.

Thanks

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 4/9/2009 3:53 AM AC [MVP MOSS]
Gravatar Ryan-
Sounds like you didn't import the custom targets file into your project (csproj) file. Look at figure 7 in the post.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 4/22/2009 2:28 PM BW
Gravatar AC - First, this is really great information. We're in the early stages of a sharepoint site and struggling with how to track and manage changes...so this does help.
With that said am I missing the boat or could this be a fairly tedious and painful process for a richly customied site? If we use the "goodness" (I use that term lightly) of SP Designer each WCM management change has to individually exported, then imported to a VS project. Then each item has to be added to the Manifest.xml and the Provision.xml and the the ddf. For a heavily/richly customized site this can be a lot of files to track (assuring they are part of a realeasble unit) and include one by one.

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 4/22/2009 2:34 PM Siva
Gravatar Hi Andrew,

I have copied the code to add tasks and I have followed all the above steps mentioned above to install and activate the feature. Till the activation of feature everything seems to work fine but Execute method is not being called and the task is not getting added to the list. Please help, I'm not sure what i'm missing. Below are the steps I have followed to write the timer job

1. Created a class library, added timerjob.cs and timerjobinstaller.cs
2. installed the .dll in GAC
3. Added feature.xml, manifest.xml, buildsharepointpackage.ddf, buildsharepointpackage.targets files and made necessary changes to all these files
4. Generated .wsp file
5. added solution
6. activated feature

all the above works fine but timer job is not getting executed. Please help me to solve the issue.

Thanks,
Siva

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 11/3/2009 5:54 PM JP
Gravatar Great post Andrew

Any ideas on how to have pre-build events execute? Using this approach it seems to be turned off.

Thanks!

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 11/30/2009 5:16 PM J. Aqui
Gravatar I was having the same issue as posted by Fred on 1/25/2008 9:22 AM. At first, I realized that I was creating an XML in VS and then changing the extension. So then I created a text file and used Notepad to copy the text back and forth. Still experienced the issue. Finally, I deleted the file from VS and created it as a new text file on the file system and then included it in the project. Finally worked. Along the way I discovered that I had to reload the project to accept the new DDF file.

Fred, thanks for posting your experience and getting me on the right track.

J. Aqui

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 6/3/2010 5:43 AM Rajesh Batchu
Gravatar I am unable to see the pictures as they are stored in flicker and flicker is blocked in my ofc network.

where can i see this article including pictures?

# re: Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's) 6/7/2010 6:56 AM AC [MVP SharePoint]
Gravatar @Ragesh - Some work networks block sites like Flickr... try checking the site out at home. There's no alternate location.

Post Feedback

Title:
Name:
Email:
(email will not be displayed)
Url:
Comments: 
Please add 6 and 3 and type the answer here:    
All Comments Are Filtered & Moderated
Unfortunately comment spammers are just too effecient and are constantly dirtying up blogs with irrelevant and unwanted comments trying to improve their standing on search engines. All comments on this blog are moderated. I do not censor comments, but I don't approve comments with vulger language or those soliciting products. Most of the time comments are approved within a few hours of being submitted with the only exception when I'm traveling.

Why are you asking for my email address?
The only reason I'm asking for your email address, which isn't required to submit a comment, is to provide a gravatar if you've created an account for yourself and associated your email address with a small image. If you have a gravatar created for the email address you submit, it will appear next to your comment. Otherwise nothing will appear.

What is a gravatar?
A gravatar is a "globally recognized avatar." You can get more information about gravatars, as well as create your own for free, at www.gravatar.com. You can also view my gravatar here.


Copyright © 2003 - 2012 Andrew Connell
Creative Commons License 
This work is licensed under a Creative Commons License

 
SharePoint Training
Looking for SharePoint 2010 training for developers, administrators, power users, information workers, end users & web designers? Look no further! My company, Critical Path Training offers the best SharePoint training around! We offer public & private classes both as in-person instructor-loed hands-on classes and online classes. Check out our schedule and course catalog for all the ways we can get you going on your SharePoint path!