VS2010 database project cannot execute stored procs from within VS due to path2 null parameter error

Posted on 2012-08-31
Last Modified: 2013-11-26
In a VS2010 database project containing stored procedures, edit any procedure, right click and connect to the database server, select the correct database in the toolbar, click execute button on the toolbar, get error message in popup dialog:

Cannot execute script:

Additional information:
-> Exception has been thrown by the target of an invocation. ( mscorlib )
 -> Value cannot be null.
     Parameter name: path2 ( mscorlib )

Click the OK button to dismiss dialog.  Status in tab of open file has "executing..." in it.  Click X to close file. Get the following message:

The query is currently executing. Do you want to cancel the query?

Click Yes to dismiss the dialog. Then VS disappears ( i.e., crashes/exits ).

I have a few database projects. This one consistently gives me this error. Others rarely. The error occurs within VS2010 for the same project copied on more than one workstation. ( So, I know it's not the workstation environment. )  And, I have multiple databases which I can execute against and the error happens regardless of the database I use.  So, I figure its isolated to the project itself. The project is in a soln with 2 other non-db projects which build fine.

My workaround is to cut and paste into a query window to execute. The database is SQL Server 2008 R2 Developer Edition.

And, I would like to avoid deleting and recreating the project as I would have to propagate the change through many layers of source control.

Question by:azTop

    Author Comment


    Lacking an answer from this forum, I have continued to cut and paste the code into a query window as a workaround.

    Now, one of my other database projects has started to experience the same thing.

    I feel there must be an easy fix to this.  However, I am soon going to be forced to attempt to reconstruct my projects from scratch as an attempt to remedy this.

    At this point, any ideas would be appreciated.


    Accepted Solution

    Found this solution:

    Basically, having multiple config files somehow blows away the database project's reference to the Properties\Database.sqlcmdvars file.  The reference can be reset in the project properties deploy tab by selecting the file in the dropdown.

    For me, just bringing up the project properties resulted in getting a message that the file was missing and had to be created... will create it for you.  But then, you still have to set the reference in the deploy tab as mentioned above.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
    This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now