CRUD, C#, SQLite, and Visual Studio 2022

Figure 1: Visual Studio 2022 Preview Community Edition

As you may have noticed, a new version of Visual Studio was released just recently. It is still in Preview 1 but I’m interested to find out if the code which we have built for our Business Card App is still working.

I am happy to tell – it does.
I ran into two minor hick-ups which are explain and solved here below.

I created a new Virtual machine and installed Visual Studio 2022 Community Edition. When installed I used “Open up a project or solution” end navigated to my Business Card solution folder and selected the solution file BusinessCard-DB.sln (figure 3) to open the project.

Figure 2: Open Project dialogue
Figure 3: Select the solution file (.sln)

When the project was loaded, I clicked Start, to Debug/Run the code. Here something happened though: a dialogue showed up asking if I wanted to target to .NET Framework 4.8.

The reason for this is that we’ve used .NET Framework 4.6.1 using Visual Studio 2019, which is not installed in this new Visual Studio.

Figure 4: Target Framework missing

The dialogue gives you 3 options (figure 4):

  1. Update the target to .NET Framework 4.8 (Recommended)
  2. Download .NET Framework 4.6.1 targeting pack (opens in browser)
  3. Do not load this project.

I used the default here (1) and clicked Continue.

Now the application started up normally, but I received an error message (figure 5): “Can’t connect to the database!”.

Figure 5: Cant connect to the database!

I just changed the path to the database and restarted the application and now it worked as expected.

So, rather simple issues and if you had your database in correct path, which I didn’t have, you probably just ended up with 1 issue.

Please let me know if you have other issues and I will try to help

For those of you coming across this post and do not know what Business Card Application I’m referring to you, can find it on UDEMY:


5 3 votes
Article Rating
Tags: , , , , ,