Friday 30 August 2013

Could not load file or assembly "" or one of its dependencies. The system cannot find the file specified

I got the above exception while deploying the code.So I quickly checked the following things.

1.Public Key of the assembly and it is correct.
2.Version of the assembly and it is updated one.But still I got the same error.

So I followed below steps and it worked.

1.Copy the dll and paste it any where in the server.
2.Open Start->Microsoft Visual Studio 2010->Visual Studio Tools->Visual Studio Command Prompt(2010)

Run the command below:

gacutil /i "Path of the assembly where it is located"

It will install the assembly into Global Assembly Cache.

3.Add it to the respective application bin folder.(Some times it is not needed)
4.Drag and Drop the dll file into "C:\Windows\assembly" folder(Optional)

Above steps resolved my problem.

Sunday 11 August 2013

Backup and Restore SiteCollections using PowerShell

Backup the SiteCollection:

1.Open SharePoint Management Shell from SharePoint Products
2.Create a folder named as "SharePointBackups" in D: drive.
3.Run the below command
   Backup-SPSite -Identity https://sharepoint.com -Path D:\SharePointBackups\mysite.bak -Force
 
   It will create a mysite.bak file in SharePointbackups folder.

Restore the SiteCollection:

Run the below command:
   Restore-SPSite -Identity "Target Site Url" -Path "D:\SharePointBackups\mysite.bak" -Force

It will restore the site collection in target site.