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

Posted on 2012-08-31
Medium Priority
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
  • 2

Author Comment

ID: 38451001

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

azTop earned 0 total points
ID: 38459733
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
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. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…

609 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