My manager told me: "We don't create a WSP package for an entire existing SharePoint site, we just need to package master pages, CSS, images and page layout files into a solution package." Is it possible to create something like this?
Ok, for the wsp part follow laurie, or if your lazy add wspbuilder to visual studios to build the wsp for you.
now to add the masterpage and css:
create an empty project
as you can see above, remove the sample.txt, right click styles and add your masterpage and add another module for css :)
for the css, click on the elements.xml and add the following:
Url = “Styles Library” and file Type = GhostableInLibrary
<Module Name="Styles" Url="style Library"> <File Path="Styles\newstyle.css" Url="newstyle.css" Type="GhostableInLibrary"/> </Module>
the first part
Styles\newstyle.css is the module name and then the file name, the url is the location you want it in. The module url is the location you want to add this to.
<Module Name="Module" List="116" Url="_catalogs/masterpage"> <File Path="Module\Sample.master" Url="Module/Sample.master" Type="GhostableInLibrary" IgnoreIfAlreadyExists="false" /> </Module>
same as the css the masterpage is the same,
Module\Sample.master module is the module name and the sample.master is the file name within the module within your project. the module url is saying to put the file within the catalogs area.
for images and for page layout files can be done exactly the same way!
page layouts: http://blog.beckybertram.com/Lists/Posts/Post.aspx?ID=71
add image to the module folder, your elements file will look like this:
<Module Name="Previews Images" Url="_catalogs/masterpage/$Resources:core,Culture;/Preview Images"> <File Path="Preview Images\image.png" Url="image.png" Type="GhostableInLibrary"> <Property Name="Title" Value="Custom Preview Image" /> </File> </Module>
or instead of module just create the directory within your project
14/template/images add the image files within this folder will add them to 14hive image folder.
as i said above you can do laurie's way or.... use ms build:
On the Windows Start menu, choose All Programs, Accessories, Command Prompt.
Change to the directory where your SharePoint project is located.
Enter the following command to create a package for the project. Replace ProjectFileName with the name of the project.
msbuild /t:Package ProjectFileName
example, you could run one of the following commands to package a SharePoint project called ListDefinition1.
msbuild /t:Package ListDefinition1.vbproj msbuild /t:Package ListDefinition1.csproj
or you can use wspBuilder (which i use), download it, install it to Visual studios and right click your project.. select wsp build, select build wsp. The wsp will be added to the project for you. If you goto the directory where you can see the project files youll see the wsp there aswell.
build (ignore the cmd as your using vs2010 build not cmd)
I hope this answers all your questions! Iv tried to make it as simple as possible! your tasks should be very simple... once you have done one module the rest is very simple todo and easy to understand :) , wspbuilder is easy to use and fast for creating as you dont need to do any manifest as it does it for you!
With Visual Studio 2010 it is easy to build a WSP. Additional tools are not required, especially for a project as you described. The basic steps are:
- Create a new SharePoint 2010 project using the Empty SharePoint Project template.
- For each of your items that you want to add, right click on your project in Solution Explorer and choose Add New Item.
- Choose the item type (Visual Webpart, etc.) and VS2010 will stub out your files. An element manifest is automatically created for you and it is automatically added to a feature.
- When you are ready to create your package, you can use VS2010. Right click on your project in Solution Explorer and choose Package or Deploy (which will package and deploy to whatever site you have specified in your project properties).
Here is a Visual How-To to get you started.
in visual studios 2010:
With Visual Studio 2010 it is much easier to build a wsp. Additional tools are not required, especially for a project as you described. The basic steps are:
1.Create a new SharePoint 2010 project using the Empty SharePoint Project template.
2.For each of your items that you want to add, right click on your project in Solution Explorer and choose Add New Item.
3.Choose the item type (Visual Webpart, etc.) and VS2010 will stub out your files. An element manifest is automatically created for you and it is automatically added to a feature.
4.When you are ready to create your package, you can use VS2010. Right click on your project in Solution Explorer and choose Package or Deploy (which will package and deploy to whatever site you have specified in your project properties).
above was taken from:
For SPD it packages workflows in wsp format but anything else your out of luck! reason being that you need to have a feature or other to deploy the files and cant just be in a wsp file. So back to 2010 you would need to go to make the feature and package the files! so best to stick with vs2010 as it does most of the work for you compared to vs2007 which is far harder compared to 2010.
for vs2012 as you require follow this doc: (still simple to make wsp/features ;) for your requirements)
See if this works for you
Export the Sharepoint Site into a wsp file Import wsp file into a Visual Studio project
I have not tried this check this msdn link
Have you tried "Site Settings->Site Actions->Save Site as Template"? It doesn't create a WSP but it create a .STP file that allow you to recreate the site with all its contents.