OK, I managed to get this sorted out. It seems I was looking in the wrong place. I Googled "Connecting to an MDF File in .NET 6.0" (which is the version of .NET I am using) and discovered that I need to go into "Server Explorer" (NOT "Data Sources"!) and connect to my .mdf file from there. It turns out I don't need to use an earlier version of .net.