我正在做一个使用 smo 对象(服务器、数据库)的 C# 项目。
我包括了
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Server;
我添加了 Microsoft.SqlServer.Management.Smo、Microsoft.SqlServer.Management.SmoExtended、Microsoft.SqlServer.SqlEnum、Microsoft.SqlServer.ConnectionInfo。
但我仍然遇到这样的错误(10 个与此类似的错误):
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'.
如何解决这个问题??
最佳答案
好吧,我认为这个错误很容易解释,包括对 Microsoft.SqlServer.Management.Sdk.Sfc
的引用。您没有列出您添加了该引用。有时,当您添加使用未包含的其他 dll 引用的引用时,您必须包含那些其他引用......即使您没有使用它们。
关于C# smo 项目程序集未引用错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9730530/