Recently I stumbled upon really weird issue with VS 2010. We have bunch of database projects created in VS 2010 which are part of our regular development build. As part of my task, I was trying to automate deployment of these database projects using PowerShell and came across really really strange issue that I have never seen before.

I was simply checking out database project from our source control and using MSBUILD (aka MSFT Build Engine) to build and deploy the database project to my test SQL Server instances. Ideally what it does is it allows me to deploy that database at instance that I wish with database name of my selection. But with my surprise when I built and tried to deploy the project I was welcomed with this error …

 

Build_Error

 

Which basically means that it is missing some objects and because of that MSBUILD was failing to build project. And what was odd is, if I opened up that project in VS 2010 then I was able to build that project without any error !! … I thought that Google should know what is going on here. So I Googled the error but I didn’t find any post .. any question about similar issue. After frantically looking for this issue over internet, I stumbled upon this not so related … more than 3 year old question at MSDN and it clicked me that may be VS still have that age old bug mentioned in post for VS2008… ideally when you add or remove any DB object from your Database Project, it automatically updates .dbproj file … but due to some kind of bug in VS 2010 it fails to do so and because of that even if you remove object from project your .dbproj file still refers to those removed reference and because of that it was failing to build. So once I removed those entries from .dbproj file, I was able to build and deploy this project successfully.

May be it was obvious for someone who’s only job is to maintain project builds … but for me it was quite a time consuming process because I was expecting VS 2010 to do it’s job properly. But I am glad that even after wasting this much of time I was able to resolve this issue so to me it was not a waste of time Thumbs up

On a side note, I tried to reproduce this issue but so far I am unable to do so. But this issue still exists in our database project, which means if I run into this issue again in future (which I am sure I will Don't tell anyone smile) I know what I have to do to fix it Winking smile

That’s it for now …

It’s Just A Thought … Peace

Gaurang Sign

Random Posts:


Similar Posts: