开发者

Namespace 'Smo' not found, although the reference is added

I have added Microsoft.SqlServer.Management.Smo.dll reference to my project, but it still gives me the error below. The referenced dll is in C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies p开发者_运维技巧ath.

Error 25 The type or namespace name 'Smo' does not exist in the namespace 'Microsoft.SqlServer.Management' (are you missing an assembly reference?)

All the classes that I use such as Restore, Serer class under the Smo namesapce also throws the error.

Please advise.


Where are you consuming this from? Any chance you're using the client profile (under project properties -> Application -> Target Framework)? I've been caught out a number of times by that. If that's the case, it's usually as simple as selecting a non-client profile framework version.

Anyway, can we get some more detail about what kind of solution this is?


I have had the same problem, I noticed my project was targeting framework 3.

Changing to 3.5 or 4 helped solve the problem.

My reference are to

Microsoft.SqlServer.ConnectionInfo
Microsoft.SqlServer.Smo
Microsoft.SqlServer.Management.Sdk.Sfc


I think you have to add all 4 dlls (link):

Most of the classes Microsoft.SqlServer.Management.Smo namespace resides in the Microsoft.SqlServer.Smo.dll and Microsoft.SqlServer.SmoExtended.dll files. Additionally, some of the enumeration classes are in the Microsoft.SqlServer.SqlEnum.dll and Microsoft.SqlServer.SmoEnum.dll assembly files. You will have to import all four files to access all of the classes in the Microsoft.SqlServer.Management.Smo namespace


If you are using Visual Studio 2008 then

Add References Microsoft.SqlServer.ConnectionInfo Microsoft.SqlServer.Smo Microsoft.SqlServer.SmoEnum Microsoft.SqlServer.SqlEnum

if still u got error then add two more dll

microsoft.sqlserver.SmoEx... Microsoft.SqlServer.ConnectionInfoEx...


Hope it will work

Thank you.


add reference to "Microsoft.SqlServer.Management.Sdk.Sfc.dll" from "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies" will eliminate this error.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜