Thursday, February 10, 2011

Cannot load file or assembly "Microsoft.SqlServer.Management.SqlParser"

Error: Cannot load file or assembly "Microsoft.SqlServer.Management.SqlParser"
Scenario: Adding a new SQL Server 2008 Database Project in Visual Studio 2010

I wanted to share the issue I found today while trying to create a SQL Server 2008 Database project in Visual Studio 2010. I have an existing database project in SQL Server 2008 and I wanted to include the database project in Visual Studio 2010 for Source Control Reasons. If you want to create a SQL Server 2008 DB Project you need to follow these steps:

1 - Right click on the Solution or Solution Folder where you want your db project to be created.
2 - From the project templates dialog box, go to the Database Node and select the template you want.

You can also find a step by step tutorial on how to create a new DB projects in Visual Studio 2010 here or how to include a existing DB in Visual Studio here.

Now the issue was that when I selected the SQL Server 2008 Database project, Visual Studio game me an error saying that "Could not load file or assembly Microsoft.SqlServer.Management.SqlParser, Version= blah blah"

This seemed quite estrange since I had SQL Server 2008 with SQL Management Studio and Visual Studio 2010 working just find for all the other tasks I was working on. Doing a little online research the first thing I realized was that getting the right answer for this error was very difficult. Most forums and articles I found suggested that I needed to reinstall Microsoft SQL Server 2008 Management Objects (SMO) components, or reinstall Visual Studio, which I wanted to avoid. I tried to download and install SMO components individually but it didn't work. At last my colleague Herberth Madrigal shared this link on how to install individual Visual Studio components.

Basically I had to first mount my image of the Visual Studio installer and then find the individual installers directories. Most of them are under the "WCU" folder. Then I had to install the following individual components:

SQL Server System CLR Types
SQL Server 2008 R2 Management Objects
Microsoft SQL Server 2008 R2 Data-Tier Application Framework
Microsoft SQL Server 2008 R2 Data-Tier Application Project
Microsoft SQL Server 2008 R2 Transact-SQL Language Service

Note that to install the individual components, you need to open the command prompt window, navigate to the directory where the component installers are located and then enter the install command "MSIExec /i" followed by the specific command to install the component, which you can find in the link mentioned above.

Remember to do all this after you closed Visual Studio and also remember to restart your computer after the install process of all components has finished.

After restart, run Visual Studio and you should be able to add your SQL Server 2008 Database project to your solution.

Thanks to Herberth for the link and the install process help !



  1. Where can I find those instal files? How are they named?

  2. Florian, the files are under the WCU folder on the Visual Studio installation folder. This means in the Visual Studio installation DVD or the extracted Visual Studio Installation folder if you downloaded it.


  3. Pto Trial version i have checked it under WCU folder but the content you mentioned is not present there

  4. Check the different possibilities. It might be different depending on your OS installation and your VS version, but you should be able to find the files. Perform an explorer search for the files just in case. Let me know.

  5. Visual Studio 2010 Professional CD does not have the 5 installers that you mentioned.

    We are using a Windows Server 2008 - 32 Bit Operating System... so we are using SQL Server 2008 Standard.

    So I did a google search and downloaded the equivalent 5 items you mentioned in this article... HOWEVER the Microsoft.SqlServer.Management.SqlParser error still persists in Visual Studio 2010 Professional when attempting to create a new SQL Server 2008 Database Project.

    The search continues... SIGH!

  6. Updated SQL Server 2008 with these updates:

    Applied SQL Server 2008 Service Pack 3.

    * Didn't resolve the issue.

    Uninstalled and Reinstalled Visual Studio 2010 Professional. Then applied the Visual Studio 2010 Service Pack 1.

    Now Microsoft.SqlServer.Management.SqlParser shows up in the GAC Data in the C:\Windows\Assembly\ Directory on the

    Windows 2008 Server - 32 Bit Operating System.

    Hope this helps someone else resolve this very ANNOYING issue!


  7. Worked for me, thank you very much.

  8. The solution as described in the original post solved the problem for me.
    I had to search for the files though. I found them in the directories WCU\SMO (4 files) and WCU\DAC (3 files).

    1. Thanks for pointing me to right install paths.

  9. This was exactly what I was looking for and worked perfectly. Thank you.

    Note: The link you reference points to an MSDN page saying the topic no longer exists; however, the comment above mine was enough to help me find the necessary files.

    Thanks again