When I try to publish a SQL Project to a database (SQL server 2008 r2) from Visual Studio 2013, I get a dialog box saying
"Object reference not set to an instance of an object"
and then the publish never finishes (the progress icon keeps spinning).
When I click in the "Output" tab, I don't see any errors there. It says:
========== Build: 4 succeeded or up-to-date, 0 failed, 0 skipped ==========.
When I do a "Schema Compare" from VS 2013 between my project and the production database, I get the same error.
Is there any way to track down how and why VS2013's Data Tools Operations is producing that error?
I ran into this problem again. My problem was that the definition of one of my table-valued functions in the server (the target server of the publish) had a SQLCmd parameter commented out:
CREATE FUNCTION MyProblematicFunc
(
@beg_date date,
@end_date date
)
RETURNS TABLE
AS
RETURN
(
SELECT
Name,
Address,
--,cast([$(DBreferenceFromVS)].[dbo].[ConvertNumToDate](NumericDate) as DATE) [Create Date]
-- ^^^^ This comment above was causing the error on publish and on schema comparison. I had to remove it in the server
FROM RandomTable