• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 897
  • Last Modified:

Missing Assembly Reference .NET 3.5

I am tryng to create some SQL Database objects programmatically using C# in Visual Studio 2008. The "Management" namespace is missing and this is preventing me from accessing the needed classes.  How can I remedy this problem, which I suspect is due to  a problem in the Global Assembly Cache ?

using System;
using System.Data;
using System.Data.SqlClient;
using Microsoft.SqlServer;
using Microsoft.SqlServer.Management.Common
using Microsoft.SqlServer.Management.Smo

namespace ConsoleCreateSqlDataBase
{
    class Program
    {
        static void Main(string[] args)
        {
            string sqlConnectString = "Data Source=(local);" +
                "Integrated security=SSPI;";

            //Use SMO to create database
            Console.WriteLine("--Create Database using SMO--");
            Server server = new Server("(local)");
        }
    }
}

Error      1      The type or namespace name 'Management' does not exist in the namespace 'Microsoft.SqlServer' (are you missing an assembly reference?)
0
Stoutfellow
Asked:
Stoutfellow
1 Solution
 
Roopesh ReddyCommented:
Hi,

Check this MSDN article -

http://msdn.microsoft.com/en-us/library/ms162129.aspx

Hope it helps u...
0
 
StoutfellowAuthor Commented:
Thanks roopeshreddy! I had failed to add the needed assembly references to the Solution Explorer (blush).
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now