Click here to Skip to main content
15,867,568 members
Articles / Programming Languages / C#
Article

How to Create Installer (.cab) for web part?

Rate me:
Please Sign up or sign in to vote.
3.36/5 (7 votes)
30 Jun 20052 min read 61.1K   161   21   3
A sample project (Hello world webpart and installer project) and walk through for creating an installer for web part that will install the webpart on the share point portal site.

Introduction

A sample project (Hello world webpart and installer project) and walk through for creating an installer for web part that will install the webpart on the share point portal site.

It will make a SafeControl entry in share point portal site's webconfig file, will add a file in the share point portal site's wpcatalog, will create a folder under share point portal site's wpresources directory and add files to the created folder.

Assumptions

  • Hello world webpart project is ready for use.
  • Developer knows how to add a webpart to the share point portal site.
  • Developer has knowledge of webparts and share point portal site.

How to add a .cab project to the existing web part solution?

  1. Right click the solution and navigate to Add -> New Project.
  2. Select Setup and Deployment project from project type.
  3. Select Cab Project from Template section.
  4. Write the appropriate Project name, select the appropriate project location and click OK.

How to add (file installation properties) the project output to the .cab project?

  1. Right click on the .cab project. Navigate to Add -> Project Output.
  2. Select the Primary Output and Content Files from the available list.

How to add the file to the Primary Output file installation properties?

  1. Right click on the Primary Output.
  2. Select Properties.
  3. In the Primary Output properties click on Outputs and select the WpSampleHelloWorld.dll.

How to add the file to the Content Files file installation properties?

  1. Edit Manifest.xml in the webpart project.
  2. Under the section <ClassResources>, add an entry like <ClassResource FileName ="minus.gif"/> for each file that needs to be deployed under "wpresources\WpSampleHelloWorld".
  3. Assembly mentioned under the section <Assemblies> will be deployed in the share point portal's bin directory.
  4. DWP file mentioned under the section <DwpFiles> will be deployed in the share point portal's wpcatalog directory.
  5. Right click on the Content Files of the installer project.
  6. Select Properties.
  7. In Content Files properties click on Outputs and it will show the entire files that are part of the current project in the popup window.

How to run the cab file?

  1. Edit the .bat file WpSampleHelloWorldInstaller.bat and modify "http://ABC/" to the required portal site.
  2. Through the command prompt, navigate to the directory where WpSampleHelloWorldInstaller.bat and WpSampleHelloWorldInstaller.CAB are present.
  3. Enter the WpSampleHelloWorldInstaller.bat file name on the command prompt and press the Enter key. It will show a success message.
  4. Verify that a SafeControl entry is added to the webconfig file and "WpSampleHelloWorld_1.0.0.0__b8904f2e5aa5eda1_HelloWorld.dwp" file is added to the wpcatalog directory. Create a folder with the name "WpSampleHelloWorld" under wpresource directory and add all the files that are mentioned in manifest.xml to the "wpresource\WpSampleHelloWorld" directory.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
Rajshekhar Chittoory

Comments and Discussions

 
Questionhow ot use it for desktop application Pin
bhavesh_130322-Sep-05 3:16
bhavesh_130322-Sep-05 3:16 
GeneralRe: how ot use it for desktop application Pin
Member 426753811-Mar-08 1:18
Member 426753811-Mar-08 1:18 
GeneralRe: how ot use it for desktop application Pin
Member 426753811-Mar-08 1:18
Member 426753811-Mar-08 1:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.