Thursday, January 15, 2015

Creating a SharePoint solution without any tool WSP Builder and VS2010. (Learning Basics)

To deploy anything into SharePoint you need below given three files :

1. Manifest.xml - Data about your solution structure.
2. ddf - Data 
3. dll - 

These are the files we need to deal with while deploying a solution in SharePoint. However now a days we have all these file creation and deployment would be done by Visual Studio or WSP builder.
These are aweesome tools and are very efficient, But as a Sharepoint Developer we still need to learn what happens behind the scene, files and its roles.

1. dll file - Just rebuild your solution and open BIN folder of your solution. Copy this dll file and copy it to the deployment folder of your application. Copy this DLL file into GAC and get details of public key token.

2, Manifest,xml -  Just add this file into Deployment folder. And provide all details as per your solution. 
SolutionId - Create a new GuId in registry format and add it.
PublicKeyToken - Details of your dll from GAC.

<?xml version="1.0" encoding="utf-8" ?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/"
 SolutionId="{04B8CC83-70A0-49cb-A745-91A89437A93F}" >

  <Assemblies>
    <Assembly DeploymentTarget="GlobalAssemblyCache" Location="TestByKrishna.dll">
      <SafeControls>
        <SafeControl Assembly="TestByKrishna, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1723b722c17f1304" Namespace="TestByKrishna" TypeName="*" Safe="True" />
      </SafeControls>
    </Assembly>
  </Assemblies>

</Solution>

3. ddf file - This file will be used as an input file for running makecab.exe utility. Just replace the dll file name and name of the WSP you want.

; makecab.exe tool takes a pointer to a .ddf file, 
;which describes the structure of the .cab file.  
;The This file is for WSP CAB Generation
;A WSS or in this case MOSS solution file is essentially a .cab file, 
;use the makecab.exe tool to create the solution package. 
;Theformat of a .ddf file is basically that
;you declare a standard header and 
;then enumerate, one file per line, the set of files by where they live on disk, 
;separated by where they should live in the .cab file

.OPTION EXPLICIT     ; Generate errors 
.Set CabinetNameTemplate="TestByKrishna.wsp"
.set DiskDirectoryTemplate=CDROM ; All cabinets go in a single directory
.Set CompressionType=MSZIP;** All files are compressed in cabinet files
.Set UniqueFiles="ON"
.Set Cabinet=on
.Set DiskDirectory1="Package"
;All file reference should be from the project root
;Files to place into the CAB Root

; Manifest
Manifest.xml

; DLLS
TestByKrishna.dll

Now run the following command from by cmd by pointing to the Deployment folder of your solution. Which contains these three files. 


You can see WSP in the package folder of your solution as per below image :


Now you can deploy your WSP on any server using Stsadm or powershell or Central Admin.

No comments:

Post a Comment