ADO.NET Database first error after update (VS2022)

Joel Almeida 20 Reputation points


I updated VS2022 to V17.6.1 and I think that after this update (or previous one I'm not really sure) I get the error : "Running transformation: System.NullReferenceException: Object reference not set to an instance of an object.".
What happens is that the diagram is generated correctly with the changes I made but the Models .cs aren't created and I get the error. When I double click it it shows me the file. I tried to compare it with one from a backup and they look like the same. I'm lost and can't get when I get this NullReferenceException. I never had this error before, even when updating models.


Microsoft Technologies based on the .NET software framework.
1,139 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
3,132 questions
{count} votes

Accepted answer
  1. Tianyu Sun-MSFT 16,831 Reputation points Microsoft Vendor

    Hello @Joel Almeida,

    Welcome to Microsoft Q&A forum.

    Probably, this issue is caused by updating VS 2022 to the latest version. Please kindly check these two threads: Create or recreate a Model does not work any more for winform .net framework solutions, Cannot import anymore tables into edmx. “Running transformation: System.NullReferenceException: Object reference not set to an instance of an object.”.

    If you get the same issue, please try the workarounds which are shared in above links and if possible, try to downgrade to a previous version of VS 2022 temporarily, for example, version 17.5.4/17.5.5.

    If the issue you get is different from the issues mentioned in above threads, please try following methods:

    1. Rename/remove ComponentModelCache folders in C:\Users\username\AppData\Local\Microsoft\VisualStudio\17.0_XXXXXXXX.
    2. Reset VS settings by running devenv /ResetSettings in Developer Command Prompt for Visual Studio 2022.
    3. Remove the hidden .vs folder in your solution folder and rebuild your project.

    Best Regards,


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Dirk Pilipow 0 Reputation points

    Same problem here, but can't downgrade to 17.5.5 or 17.5.4 because rollback is only available for 17.6 and i can't find a bootstrapper for 17.5 Community Edition. might bei a solution for the problem. Worked for me with VS2022 17.6.2

    0 comments No comments