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?
- Right click the solution and navigate to Add -> New Project.
- Select Setup and Deployment project from project type.
- Select Cab Project from Template section.
- 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?
- Right click on the .cab project. Navigate to Add -> Project Output.
- Select the Primary Output and Content Files from the available list.
How to add the file to the Primary Output file installation properties?
- Right click on the Primary Output.
- Select Properties.
- 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?
- Edit Manifest.xml in the webpart project.
- Under the section
<ClassResources>
, add an entry like <ClassResource FileName ="minus.gif"/>
for each file that needs to be deployed under "wpresources\WpSampleHelloWorld". - Assembly mentioned under the section
<Assemblies>
will be deployed in the share point portal's bin directory. - DWP file mentioned under the section
<DwpFiles>
will be deployed in the share point portal's wpcatalog directory. - Right click on the Content Files of the installer project.
- Select Properties.
- 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?
- Edit the .bat file WpSampleHelloWorldInstaller.bat and modify "http://ABC/" to the required portal site.
- Through the command prompt, navigate to the directory where WpSampleHelloWorldInstaller.bat and WpSampleHelloWorldInstaller.CAB are present.
- Enter the WpSampleHelloWorldInstaller.bat file name on the command prompt and press the Enter key. It will show a success message.
- 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.