sql-servervisual-studiosql-server-2012

Object reference not set to an instance of an object: on Publish


When I click a publish button:

PUBLISH BUTTON

on the Database project in Visual Studio I cannot access the publish window and I just get a popup that says Object reference not set to an instance of an object.

ERROR

Therefore any changes to the database are impossible. my co-workers do not have this problem at all and if they had the issue dissapeared after updating Visual Studio

What I tried

I suspect the issue is somewhere in the project and my machine since other projects works fine in this scenario. Still other coleagues can change whatever they want and publish without any issues. On my coworker laptop the issue is gone even if I sign in with my own Profile and pull the branch where I have made changes.

Worth noting that other projects in the company does not run on the same framework. No project that runs on the same framework as the one that I am facing the issue can be tested, except a dummy project that I have created and there the issue is gone.

I am hopeless and it is frustrating to ask my coworkers to publish the changes for me every time a new field or table is required


Solution

  • Workaround:

    Select properties of an entire solution: enter image description here

    Than change the configuration of Database project to any configuration and than back to the configuration you are using: enter image description here

    NOTE: Do not commit the solution changes otherwise the problem occurs again... Discard the changes and once you need to publish again repeat the process...