Search code examples
c#sql-serverassembliessmo

C# smo project assembly not referenced error


I am doing a C# project which is using smo objects(Server,Database).
I included

using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Server;  

I have added Microsoft.SqlServer.Management.Smo,Microsoft.SqlServer.Management.SmoExtended,Microsoft.SqlServer.SqlEnum,Microsoft.SqlServer.ConnectionInfo.

But still i am getting the errors like this(10 errors similar to this):

The type 'Microsoft.SqlServer.Management.Sdk.Sfc.ISfcHasConnection' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.SqlServer.Management.Sdk.Sfc, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'.  

how to resolve this??


Solution

  • Well, I think the error is fairly explanatory, include a reference to Microsoft.SqlServer.Management.Sdk.Sfc. You have not listed that you added that reference. Sometimes when you add references that use other dll reference's that were not included, then you have to include those other references...even if you are not using them.