VS2010 database project cannot execute stored procs from within VS due to path2 null parameter error
Posted on 2012-08-31
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:
-> 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.