We have created a feature, which has 2 application pages. One is to activate the user control and the other one is for database configuration. For the database configuration, the user has to provide the .mdf and .ldf files to restore the database.

For the restoration of a database we have used Microsoft.sqlserver.replication.dll. The feature is working fine, but when we deploy it on any other machine, at the time of activation it gives error, and the error is:

Error: Cannot add the specified assembly to the global assembly cache: Microsoft.SqlServer.Replication.dll.

The feature is working fine with windows server 2008 but it throws the mentioned error on windows server 2003. Does anyone know how to solve this?

  • What happens when you manually add the Microsoft.SqlServer.Replication.dll assembly to the problem server's GAC? Apr 13, 2010 at 13:39
  • ... after removing it manually if it already existed. Apr 13, 2010 at 13:42
  • When i manually add Microsoft.SqlServer.Replication.dll to GAC , its overwrite the already exists dll without prompt.
    – sbtahir
    Apr 14, 2010 at 4:32

3 Answers 3



do your account have full administrative privileges on the production server?

Is the assembly already present in the GAC before you add? Sometimes solution deployment cannot add an assembly if its already there.

  • Yes the assembly already exists in the GAC.
    – sbtahir
    Apr 13, 2010 at 4:17
  • The feature is working fine with windows server 2008 but its giving the mention error with windows server 2003 .. any idea?
    – sbtahir
    Apr 13, 2010 at 6:57
  • 3
    yet another reason to keep development environment as close to production as possible... Apr 13, 2010 at 7:27
  • The assembly is already present in the GAC in both windows server 2008 and windows server 2003 , its work fine with 2008 but give error on 2003..
    – sbtahir
    Apr 13, 2010 at 12:45

make sure that all dependencies of the Microsoft.SqlServer.Replication.dll is also registered. A quick lock using Reflector reveals that these are referenced by the dll:

  • Microsoft.SqlServer.ConnectionInfo, Version=, Culture=neutral, PublicKeyToken=89845dcd8080cc91
  • Microsoft.SqlServer.Management.Sdk.Sfc, Version=, Culture=neutral, PublicKeyToken=89845dcd8080cc91
  • Microsoft.SqlServer.Smo, Version=, Culture=neutral, PublicKeyToken=89845dcd8080cc91
  • Microsoft.SqlServer.SqlEnum, Version=, Culture=neutral, PublicKeyToken=89845dcd8080cc91
  • Microsoft.VisualC, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
  • We are creating wsp file of the feature using WSPBuilder
    – sbtahir
    Apr 13, 2010 at 4:27
  • You still need to make sure that those references are on the target server though. If WSPBuilder does not pick them automatically you need to add them. Apr 13, 2010 at 6:29
  • The feature is working fine with windows server 2008 but its giving the mention error with windows server 2003 .. any idea?
    – sbtahir
    Apr 13, 2010 at 6:57
  • 1
    Check if the assemblies Wictor is mentioning is in the GAC plz. They could be on the 2k8 server but not on your 2k3 server. Apr 13, 2010 at 7:27
  • Yes the assemblies which Wictor mentioned are already in the GAC
    – sbtahir
    Apr 13, 2010 at 9:49

I see you are using SharePoint on Windows Server 2003 and Windows server 2008. So it means you use SharePoint 2007 version (correct me if I am wrong) and not 2010.

When you deploy a feature, the referenced dlls are deployed to GAC while solution deployment (WSP that contain feature) and not feature activation, unless you write code to add dll to GAC on FeatureActivated. For 2007, you use below commands to deploy WSP

stsadm -o addsolution -filename YourSolution.wsp
stsadm -o execadmsvcjobs
stsadm -o deploysolution -name YourSolution.wsp -immediate -allowGacDeployment -force

Please note the -allowGacDeployment and -force flags you will need. If the above commands run successfully, you have your dlls in GAC and should not affect feature activation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.