How to install the WebPart CAB package step by step

Source: Internet
Author: User

Although many methods are provided on the Internet, most of them require third-party tools. In fact, this work is very simple and it may be easier to do it by yourself.

Step 1: Create a WebPart. Assume It is SearchBoxWebPart and name it strongly (strong naming is not required, but is recommended );
Note: Add [assembly: AllowPartiallyTrustedCallers ()] to AssemblyInfo. cs.
And AssemblyVersion
Step 2: Create a CAB Project and add two files, manifest. xml and SearchWebPart. dwp.

The content of manifest. xml is:
<? Xml version = "1.0"?>
<WebPartManifest xmlns = "http://schemas.microsoft.com/WebPart/v2/Manifest">
<Assemblies>
<Assembly FileName = "SearchWebpart. dll">
<SafeControls>
<SafeControl Assembly = "SearchWebPart, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = e01f55ae71a39d56" Namespace = "SearchWebPart" TypeName = "*" Safe = "True"/>
</SafeControls>
<ClassResources>
</ClassResources>
</Assembly>

<Assembly FileName = "Microsoft. SharePoint. dll">
<SafeControls>
<SafeControl Assembly = "Microsoft. SharePoint, Version = 12.0.0.0, Culture = neutral, PublicKeyToken = 71e9bce111e9429c" Namespace = "Microsoft. SharePoint" TypeName = "*" Safe = "True"/>
</SafeControls>
<ClassResources>
</ClassResources>
</Assembly>

<Assembly FileName = "Microsoft. Office. Server. dll">
<SafeControls>
<SafeControl Assembly = "Microsoft. office. server, Version = 12.0.0.0, Culture = neutral, PublicKeyToken = 71e9bce111e9429c "Namespace =" Microsoft. office. server "TypeName =" * "Safe =" True "/>
</SafeControls>
<ClassResources>
</ClassResources>
</Assembly>

<Assembly FileName = "Microsoft. Office. Server. Search. dll">
<SafeControls>
<SafeControl Assembly = "Microsoft. office. server. search, Version = 12.0.0.0, Culture = neutral, PublicKeyToken = 71e9bce111e9429c "Namespace =" Microsoft. office. server. search "TypeName =" * "Safe =" True "/>
</SafeControls>
<ClassResources>
</ClassResources>
</Assembly>

<Assembly FileName = "Microsoft. SharePoint. Publishing. dll">
<SafeControls>
<SafeControl Assembly = "Microsoft. sharePoint. publishing, Version = 12.0.0.0, Culture = neutral, PublicKeyToken = 71e9bce111e9429c "Namespace =" Microsoft. sharePoint. publishing "TypeName =" * "Safe =" True "/>
</SafeControls>
<ClassResources>
</ClassResources>
</Assembly>

<Assembly FileName = "Microsoft. SharePoint. Search. dll">
<SafeControls>
<SafeControl Assembly = "Microsoft. sharePoint. search, Version = 12.0.0.0, Culture = neutral, PublicKeyToken = 71e9bce111e9429c "Namespace =" Microsoft. sharePoint. search "TypeName =" * "Safe =" True "/>
</SafeControls>
<ClassResources>
</ClassResources>
</Assembly>

<Assembly FileName = "Microsoft. SharePoint. Security. dll">
<SafeControls>
<SafeControl Assembly = "Microsoft. sharePoint. security, Version = 12.0.0.0, Culture = neutral, PublicKeyToken = 71e9bce111e9429c "Namespace =" Microsoft. sharePoint. security "TypeName =" * "Safe =" True "/>
</SafeControls>
<ClassResources>
</ClassResources>
</Assembly>

</Assemblies>
<DwpFiles>
<DwpFile FileName = "SearchWebpart. dwp"/>
</DwpFiles>

</WebPartManifest>

The dll specified by Assembly is installed in the bin directory of SharePoint.

The content of SearchWebPart. dwp is:
<? Xml version = "1.0" encoding = "UTF-8"?>
<WebPart xmlns = "http://schemas.microsoft.com/WebPart/v2">
<Title> SearchWebpart </Title>
<Description> Custom search web part </Description>
<Assembly> SearchWebPart, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = e01f55ae71a39d56 </Assembly>
<TypeName> SearchWebPart. SearchBoxWebPart </TypeName>
</WebPart>
It specifies the WebPart to be installed.

Step 3: add all required dll files to the CAB Project.

Step 4: run the stsadm command to install the SDK.
Install: stsadm-o addwppack-filename C: \ SearchWebpartSetup. CAB-url [URL if you want to deploy to a specific site]

Uninstall: stsadm-o deletewppack-name SearchWebpartSetup. CAB

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.