Andrew Connell [MVP MOSS]
1350 Posts |  39 Articles |  3385 Comments
.NET  |  MCMS  |  SharePoint  |  Office System
PDCBling
SharePoint Quick Links
Article Categories
Archives
Post Categories

View Andrew Connell's profile on LinkedIn

Add to Technorati Favorites

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
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
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:
Th