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

10,439

Solution 1

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?

Solution 2

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

Solution 3

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

Solution 4

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.

Solution 5

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

Share:
10,439
slao
Author by

slao

Updated on June 04, 2022

Comments

  • slao
    slao almost 2 years

    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 path.

    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.

  • slao
    slao about 13 years
    I added all the references that you stated about, but in the code it does not recognize 'Smo' when i add [using Microsoft.SqlServer.Management.Smo] statement;
  • slao
    slao about 13 years
    I added all the references that you stated about, but in the code it does not recognize 'Smo' when i add [using Microsoft.SqlServer.Management.Smo] statement;