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?
5 Answers
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
add module
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.
for masterpage:
<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!
reference:
page layouts: http://blog.beckybertram.com/Lists/Posts/Post.aspx?ID=71
image:
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.
http://msdn.microsoft.com/en-us/library/ee231567.aspx
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
http://msdn.microsoft.com/en-gb/library/ee231588.aspx
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.
http://wspbuilder.codeplex.com/downloads/get/94507?releaseId=30858&ProjectName=wspbuilder
before build:
build (ignore the cmd as your using vs2010 build not cmd)
after build
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!
-
Is there a version of WSPBuilder for Sharepoint 2013 with Visual Studio 2013?– djmsmithMay 14, 2014 at 13:58
-
1no there isnt as 2013 uses .net 4.5 whereas the last release was for 2010 .net 3.5! for 2013 you should be able to remotely deploy to the server! You create your project as you would within VS but this time you add in the deployment url, once finished you can build the project and then click deploy. It will deploy either local or remote! msdn.microsoft.com/en-us/library/hh370987.aspx if remote it will ask for login details! May 14, 2014 at 14:38
-
1also look here for more detail why they havent followed through to 2013 stackoverflow.com/questions/16144289/wspbuilder-for-vs-2012 May 14, 2014 at 14:51
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.
-
Thanks buddy. it is too useful for me. one more question i need to add here ... How to create picture library list definition in visual studio 2010 environment ?– Red SwanJun 18, 2011 at 6:13
-
Here is a link which shows how to create a list definition in VS2010: msdn.microsoft.com/en-us/library/gg276355.aspx. However, if you only need a picture library, instead of a new list definition, you can just create a List Instance. In Solution Explorer, right-click your project, choose Add New Item > List Instance. A wizard will start where you can choose Picture Library as the list to instantiate.– LaurieJun 18, 2011 at 20:59
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).
http://msdn.microsoft.com/en-us/library/gg131919.aspx
above was taken from:
How to create the wsp package in visual studio 2010 with following features?
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)
-
when I try to create a sharepoint project, it says that there is no sharepoint server in my website. Mar 13, 2013 at 15:37
-
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.