Evgeny Tugarev

blog

  Home  |   Contact  |   Syndication    |   Login
  3 Posts | 0 Stories | 58 Comments | 2 Trackbacks

News



Archives

Image Galleries

For those who are new to the SharePoint solutions and features I would recommend to try the SharePoint Solutions Generator, which is a part of the Windows SharePoint Services 3.0 Tools: Visual Studio 2005 Extensions. It is a windows stand-alone application that converts your existing SharePoint web site into the solution package and creates a Visual Studio project for you to use. Nice isn’t it?

What I personally don’t like in the automatic tools is that they always hide some part of the job they are doing behind the scenes. In this scenario you can’t really control and sometimes understand of that is going on. So, today I would like to blog about of how to manually create the SharePoint feature containing the list, how pack it into the solution package and finally deploy it to the production server.  Everything will be done without any use of Visual Studio or other tools (only Notepad++).

So, let’s start!

Step 1. Folders

First, create the folder structure for the solution. I used MySolution but you can give a name whatever you want. Two folders were created beneath MySolution - source and bin. First is for the compiled package, second – to keep the feature and the customized list. I use the same file structure for the feature as in SharePoint - one folder per feature.  Check out your SharePoint features hive at C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\DiscussionsList and see how it’s organized.
 In the source folder I made the feature folder called MyList and 2 subfolders inside - List Templates and Messages.  In the end you will have something like this:

Step 2. Building a Feature.

Here we create our feature based on the SharePoint discussions list. Go to MyList folder and create a file feature.xml, where we reference 2 files, first – list manifest  MyListManifest.xml  and the second – schema.xml  which is describing the list metadata. And don’t forget to change the GUID of feature Id with your own!

feature.xml

<?xml  version="1.0" encoding="utf-8"?>
<Feature Id="A8E6B85F-D81A-4cc1-9708-D15FEF359DE2"
    Title="My Feature"
    Description="This is my feature containing a list"
    Version="1.0.0.0"
    Hidden="FALSE"
    Scope="Web"
    DefaultResourceFile="core"
    xmlns="http://schemas.microsoft.com/sharepoint/">
    <ElementManifests>
      <ElementManifest Location="ListTemplates\MyListManifest.xml" />
      <ElementFile Location="Messages\schema.xml"/>
    </ElementManifests>
</Feature>

Copy the original schema.xml file from the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\DiscussionsList\Discuss folder to the Messages folder, and you have a list schema to start from, MyListManifest.xml we’ll create manually in the ListTemplates folder –

MyListManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <ListTemplate
    Name="Messages"
    Type="108"
    BaseType="0"
    OnQuickLaunch="FALSE"
    FolderCreation="FALSE"
    SecurityBits="12"
    Sequence="999"
    DisplayName="My List"
    Description="This is my custom list based on the discussions list"
    Image="/_layouts/images/itdisc.gif"/>
</Elements>

What is important here is that the Name attribute must have the same name as the folder where schema.xml is placed, Messages, as SharePoint will look for the schema.xml file at that location!

After the end of this step you have 3 new files as seen on the picture

Step 3. Building a Solution Package (.wsp)

SharePoint Solution Packages (wsp ) provide a great way to distribute all your customization in just one flask and the creation of the .wsp  ain’t so painful operation as you may think, I would say it is easy as hell! Everything starts from the traditional solution manifest .xml file in the Source folder:

manifest .xml

<?xml version="1.0" encoding="utf-8"?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/"
          SolutionId="EC2EFD73-DBA2-4c0e-9C18-C8FC43F72E6C" >
  <FeatureManifests>
    <FeatureManifest Location="MyList\Feature.xml"/>
  </FeatureManifests>
</Solution>

Here, we reference our Feature.xml file that we had created before at the Step 2, and as you may guess it’s a good way to replace the the SolutionId GUID with something brand new J.  The next that should be created is the data definition file (.ddf). It’s a simple text file with the building instructions for the makecab utility because the .wsp package is nothing more than a cabinet file with the .wsp extension. (If you rename .wsp or .stp file to .cab you’ll be able to see its contents).  Let’s create a wsp.ddf in the Source folder:

wsp.ddf

.OPTION Explicit
.Set DiskDirectory1="..\bin"
.Set CabinetNameTemplate="MyListSolution.wsp"

manifest.xml

; These directory names (DestinationDir) are used for the folders creation under 12\TEMPLATE\Features

.Set DestinationDir="MyList\ListTemplates"
MyList\ListTemplates\MyListManifest.xml

.Set DestinationDir="MyList\Messages"
MyList\Messages\schema.xml

.Set DestinationDir="MyList"
MyList\Feature.xml

In this file we set an output folder for the compiled package..\bin, its name MyListSolution.wsp and we tell makecab to include 4 files (marked in red) and create 3 folders at the deployment phase (in blue). Now it’s time to build everything into a single file, but before we do that I create a build.cmd file in the Source folder with some lines to facilitate the building process

build.cmd

@setlocal
@pushd.

 @cd %~dp0

 makecab /f wsp.ddf

@popd
@endlocal

Here I reference the wsp.ddf file with processing instructions which I created before. After you run it your solution package will appear in the bin folder:

Step 4. Solution deployment.

So, the solution package has just been created and the last thing that is left to do is to deploy it to our production server. I always like then the script is doing my job, so I put 2 .cmd files into the bin folder to deploy and retract my.wsp package so I don’t have to deal with stsadm utility from command line.

 

DeployMyListSolution.cmd

@setlocal
@pushd.

@set PATH=C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN;%PATH% @cd %~dp0

 stsadm.exe -o addsolution -filename MyListSolution.wsp
 stsadm.exe -o deploysolution -name MyListSolution.wsp -local

@pause
@popd
@endlocal

RetractMyListSolution.cmd

@setlocal
@pushd.

@set PATH=C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN;%PATH% @cd %~dp0

 stsadm.exe -o retractsolution -name MyListSolution.wsp –local
 stsadm.exe -o deletesolution -name MyListSolution.wsp

@pause
@popd
@endlocal

 

After the solution is deployed you can activate the feature in the Site features menu of you site and start using the new list!
 

Step 5. Using the feature.

Before our custom list can be used the feature containing it must be activated within the SPWeb scope.

After activation is done your custom list will appear on the site’s create page and you can create list instances!

 

Have fun!
Next time I will talk about site definitions inside the solutions.

Evgeny Tugarev.

posted on Sunday, January 27, 2008 12:38 PM

Feedback

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 1/29/2008 11:43 PM Susantha
This is really useful, But still I haven't tried this out. After this comment, I am going to try this.

Thanks.

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 1/30/2008 1:08 AM Susantha
You have shown how to create a link which point to the existing discussion list.

I need to know how to create a link which point to a custom .aspx page which I have created. once i click on that link, that my custom aspx file should open, but all the navigation bars and master page in share point server should be remain the same.

Which steps I have to change for this task?
Can you please give some hints..?

Thanks.

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 3/19/2008 12:48 PM Evgeny
Sorry for the late responce, I haven't been looking into my blog for a some time. The thing you are trying to do can be done in many ways and one of the opportunities is to include the link into onet.xml file in <NavBars> sections. This might be helpful http://msdn2.microsoft.com/en-us/library/ms868602.aspx
The way I can point is the site templates :)


# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 5/21/2008 11:27 PM Bhavdip Shah
Hi,

I worked with MOSS and WSS since last 1.5 years and my most of development was carried on at client's live Sharepoint server.

Right now, I need to create a WSP file which also responsible to deploy the variations with it, My SharePoint site is fully customized with UI design (Master Page), Webparts, Custom WebPart, utility and all... and also it supports Multilingual environment with Chinese (Simplified), English (US), Dutch (Netherland) language.

I have surf many sites, still I could not get proper help from any of the resource, for building a WSP solution package in a fully customized Multilingual environment.

Plz. Help me in this matter...

-Thanks in Advance !!!

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 5/22/2008 4:03 PM Mike Fagan
What does your schema.xml look like. That is the problem I am having is formatting that file correctly and getting what is necessary in it.

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 5/28/2008 2:21 AM Bhavdip Shah
Thanks for your prompt reply...

But It creates a schema.xml file in each and every folder within it...

and each and every file was generated from the utility itself and almost it is properly nested, with anyway...

My problem was to packaged the Sites with Customized css, Images, Variations (Subsites associated with all its pages), Custom Lists and all...

User just needs to run the STSADM command line utility for Installing the package (WSP) and he has all these things that is already available in the site from which it is generated...

Waiting for your prompt reply...

-Thanks in Advance !!!

-Bhavdip Shah
(Software Engineer)


# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 5/28/2008 3:27 PM Evgeny
Hi,

I am not sure that I understand correctly your question..
you can include everything that you need on your site in just one schema.xml file - look at the sharepoint solution generator how it works and the project that it generates in Visual Studio.
Another possibility for you is save your site as a .stp template.
It can be added later on to the production environment using stsadm tool.

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 8/19/2008 2:44 PM Satyen
Evgney,
Hats off to you for your effort into this. Before reading your blog I was so confused with Features and Solutions in SharePoint. You nailed it....I mean you nailed it to the bottom. Everything is so clear now.

I am looking forward for your articles.

10.1 on scale of 1 to 10.

-Satyen

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 9/24/2008 7:11 PM yogendra
thankyou very much dude.


it's working for me.

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 10/15/2008 4:13 AM Arnold
An excellent article. Thank you!

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 10/15/2008 11:22 PM chinkul
Hi

If i create a site definition with the SP Solution generator, and if this definition has some web parts and i add them in the webpart pages availabe as part of the definition.
Say if i have deployed this site definition and created subsite, and then when i make changes to the webparts, will it still reflect in the subsite that i created with this site defnition?

If it does not reflect, what should i do, so that it reflects in all instances of webparts.
i definetly need this, as we are working on creating site definition with webparts.

You have done a great job!
Thanks for your help.

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 10/30/2008 8:09 AM Rachel
Will this work for infopath forms and form services?

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 11/22/2008 6:54 AM Rao Kamran Anwar
This is a great article. It really helped me a lot and it. I am thankful to the writer for sharing this article.

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 12/10/2008 8:28 AM cephus
Very nice. It worked out just as you explained. Thanks for taking the time to write this. Much appreciated!

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 12/18/2008 11:12 PM Dan
Can I ask what you mean by "And don’t forget to change the GUID of feature Id with your own!"

I assume that this is all done from scratch so there isnt a GUID to use... unless you meant generate a fresh random GUID?

Is that what you meant?

Thanks in advance!

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 12/19/2008 4:24 AM Evgeny
Hi Dan,

This is just to be sure that FeatureId Guid A8E6B85F-D81A-4cc1-9708-D15FEF359DE2 is only used in this example feature. If you do copy-paste you can easily forget to replace guid with new one.

Cheers,
Evgeny

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 12/19/2008 5:08 PM Dan
Thanks Evgeny,

It worked first time for me. Great post!

I'll be trawling through the rest of your blogs for similar nuggets of gold!

Regards
Dan

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 1/5/2009 9:47 AM Jonathan Camilleri
I have created a sharepoint site and I need to port it to another machine. The site consists of a couple of lists and discussions; and they were created using sharepoint.

Just guessing...
I was thinking of copying the files within the
c:\inetpub\wwwroot\wss\VirtualDirectories\21352, within the new machine, but then I'd need to configure them within IIS and sharepoint I presume.

Any idea how to do this?

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 1/7/2009 3:50 AM jayanth
Hey i need to create a WSP to a webservice .
Is it possible as i tried the above mentioned method but it didn't work .
Any help????

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 2/2/2009 9:38 AM n8
Very nice, bro! This really simplified things for me.

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 3/14/2009 9:36 AM dll
I have to say….thanks….this article is much more clear and efficient…

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 4/20/2009 12:24 AM Mahendra
Hi,

I want to create a sharepoint site like the below can you please guide

http://www.kroger.com/Pages/default.aspx

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 5/8/2009 7:47 AM Sreenath
Hi Evgeny

I was following your blog post step to step to package an existing picture lib into a solution and deploy on a destination server.

I however faced the following issue:
The list when deployed gave an error: "File Not Found", but still had deployed the solution. When I created an instace of the list, I found that it had no views, although I had packaged all the view .aspx files in the wsp and had included all the appropriate paths. Also it did not allow me to create views on the create instance and errored out.

I later found that the solution to this error was in the Feature.xml where I needed to include references to the view .aspx as well using the ElementFile tag as below:
..
<ElementFile Location="Schema\Schema.xml" />
<ElementFile Location="Schema\AllItems.aspx" />
..
After adding these tags in the Feature.xml, everything worked.

I don't know if you have missed this in your tutorial or I am going wrong somewhere in following your steps. Just let me know what I could be missing.

Cheers
Sreenath

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 7/22/2009 9:02 AM Anton Vishnyakov
Good post, thanks.
Well, I use it for deploy my solution but I don't know how use images for _layout directory in this case.
For example ImageUrl attr in Feature xml-node use path from _layout dir - how I can write it in wsp.ddf?

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 7/27/2009 11:12 AM Nanoatzen Castro
Hi Evgeny Tugarev, good article only I have one question here: after I deploy my solution I don't see my feature, I think my feature is not installed when I deploy my solution, do you know what I'm missing here?

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 8/7/2009 6:43 AM sham
Hell Nanoatzen,
May be u have not listed the feature files in manifest.xml,hence the are not processed.

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 8/7/2009 12:18 PM Rick
Great article! I always need a refresher course on how to do this, since i don't do it often. I'm glad you chose to write this article using manual procedures and not choosing the "easy" way.

Thanks

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 9/30/2009 8:11 AM Sander
Very good!!

2 things:
1 - I needed to add ..\ to the locations in the ddf file:
.Set DestinationDir="SaveAsTemplate"
..\SaveAsTemplate\elements.xml
.Set DestinationDir="SaveAsTemplate"
..\SaveAsTemplate\Feature.xml

2 - You could semi-automate the deployment by adding post-build commands (calling build.cmd and deploysolution.cmd)

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 10/6/2009 7:04 AM sara
Nice !!!!!!!!

Create Custom SharePoint Features, it is simple.

Try this too,
Custom SharePoint features and more


# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 10/12/2009 4:37 AM Arun
The article is really helpfullll!!!!!!!!!!!!!!!!!!

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 12/21/2009 1:38 PM Ogundokun Peter Adekunle
I want to know more about share point solution, can you please send me a weblink or something to enlightened me more about it. please

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 12/31/2009 12:38 AM Dnyanesh
Very good steps u have suggested..

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 12/31/2009 2:33 PM Chris
Here is a blog post I wrote explaining how to add a solution to SharePoint with a right click.

http://chrisbarba.wordpress.com/2009/04/13/sharepoint-wsp…k-add-solution/

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 2/11/2010 7:47 AM Rajesh Batchu
Good Post Thanks :-)

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 2/12/2010 1:00 PM Jeannie
Does anyone have a location where the command line arguments are posted for the Sharepoint Solution Generator?

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 4/28/2010 4:46 AM Ahmad Nawaz
i am trying to create .wsp file of my sitecollection.
where will i placed the MySolution folder
and
how can i get these ids like feature id etc?

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 5/6/2010 9:31 AM megha shukla
hi, i am not getting the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\DiscussionsList in my path. i am getting till the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\
in the 12 folder i am not getting the TEMPLATE folder.
please any body help me to solve this problem...
thanks in advance

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 5/10/2010 2:37 AM ajit jha
Hello megha

you can take schema.xml of any list feature existing at the template\features location.

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 5/17/2010 2:29 PM Michal Bojko
There is a document with all most popular methods to deploy and package a SharePoint solution. Maybe You will find it useful.

http://www.starsoft.com.pl/files/Starsoft%20SharePoint%20Competencies%20Center%20-%20MOSS%202007%20-%20Deployment%20&%20Packaging%20guide.pdf

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 6/3/2010 10:12 PM Adz
@step 3: In creating the manifest.xml file where did you get the solutionid for the file? I keep getting an error where it can't detect MyListManifest.xml

Help me please

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 7/29/2010 8:09 AM Amine
Hi,
I want to thank you for you great blog.
I tried to do a wsp package to a custom list but I was blocked in step 2, because you said that we must copy the original schema XML. But When I searched in my directories features I didn't found my custom list.

How can I do to create a feature for an existing list ?
Thanks

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 8/5/2010 5:48 AM Ravikant
Hey i need to create a WSP to a Infopath Form
it is posible to create.bcoz in this path
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES

thier is no infoform laibrary feature.xml here




# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 9/21/2010 3:16 PM Q
Is it possible to use this method to add a DLL into the GAC? Also, how do you add "_layout application pages" to a wsp? Thanks

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 11/15/2010 2:31 AM Geetha
Thanks for your detailed post. it worked for me.

kindly let me know how to deploy webparts to the sites using wsp file.

# Creating a SharePoint Solution Package (.wsp) in 5 steps 1/4/2011 1:25 AM Kiran Varma
it has shown how to add solution and deploy in SP site.
But before that how to create that solution.

Please someone let me know

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 2/15/2011 12:32 AM sri
How to create a Windows solution package .......... Can u just give the steps to proceed practically ........

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 2/21/2011 12:35 PM shashikiran
Its very detailed

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 3/10/2011 5:53 AM Pavan
I am getting an Error Saying
Error: Cannot find this file specified in the manifest file:
I am unable to figure out the issue please help me....

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 6/29/2011 7:58 AM Santosh Shirvas
A very nice, with Example and screen shots.
It makes thie tuff thing easiy..
thanx

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 7/1/2011 3:35 AM Vahag
Thanks for the Post.
I am trying to deploy custom aspx page, but this post helped me much too :)

Thanks,
Vahag

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 7/18/2011 6:38 AM venkatareddy
Hi,
It very use full for beginners


Thanks
venkat

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 7/29/2011 10:35 PM Lisa Wood
very helpful!! love the steps.

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 8/24/2011 5:43 PM Cosmin Pirvu
If you want a single EXE setup file which does all the work, Advanced Installer recently added support for installing SharePoint solutions. It uses the same approach (with stsadm.exe), but it will also support PowerShell scripts in the future.

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 11/1/2011 10:29 AM sivaprakash
this is wsp

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 11/2/2011 11:44 AM Alex Wang
Greate post!

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 12/5/2011 3:23 AM naresh
very usefull me..
thanks for giving valuable information..

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 2/9/2012 5:06 AM lollypop
Hi I was wondering, if you are a sharepoint developer, how long this actually takes to do from start to finish?
Thanks :)

# re: Creating a SharePoint Solution Package (.wsp) in 5 steps 11/4/2012 7:34 PM Nikhita
Can I get more information about sharepoint

Post A Comment
Title:
Name:
Email:
Comment:
Verification: