I have an application, a solution with multiple projects, including one database project. The application was built in .NET 4.5 Core. All the C# code projects in it were later migrated to .NET 6. I've been able to build it and deploy it, and it runs correctly on the server. I use Visual Studio 2022 on Windows 10.
I just switched to a new development laptop. The first time I loaded the solution in Visual Studio on it, was presented with this:
In upgrading to .NET 6, I ran a global replacement to update the version in all the .csproj files, but I hadn't thought to look at the .sqlproj file from the database project. Indeed, it still showed 4.5: <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
. What I wondered was why the dialog didn't give me an option to update to 6.0.
I chose the 4.8 option. The TargetFrameworkVersion in the .sqlproj file changed to 4.7.2 (not 4.8). In addition, a new, empty element was added to the same PropertyGroup: <TargetFrameworkProfile />
. The I had to reload the database project, which in Solution Explorer had been annotated by the word "unloaded" in parentheses after it. The solution did then build.
However, it still wasn't .NET 6. I thought I'd see what happened if I just changed it to v6.0
. What happened is that the project became unloaded from the solution again. I reloaded it. A dialog appeared, similar to the previous one, except this time the second option was "Download the .NET Framework 6.0 targeting pack (opens in browser)". The first option was still the one marked "Recommended".
I chose the 6.0 option. In my default browser (Chrome), the URL https://www.bing.com/?ref=go&linkid=prd=12485&pver=12&sbp=TargetPackMissing&os=0&over=&plcid=0x409&olcid=0&clcid=&ar=&sar=&o1=.NETFramework,Version=v6.0&o2=&o3=&o4=&o5= was loaded. What appeared was the Bing home page! Huh?
Turning back to Visual Studio, I noticed that the project remained marked "(unloaded)".
So many questions:
- Given that this never came up on my old laptop, why did Visual Studio decide to have problems with the application on the new laptop?
- What is a "targeting pack"? I have .NET 6; is this something in addition to that that a SQL database project requires?
- Why is it referring to .NET Framework 6 when there's no such thing as .NET Framework 6?
- Why is 4.8 "preferred" when my application is in 6? Is it really preferred or is this an error?
- If it claims to be upgrading to 4.8, why does the project file say afterwards that the target framework is 4.7.2?
- Why is it sending me to the Bing home page? Where is it supposed to be sending me?
- How do I fix this and get the database project on the right version of .NET?
UPDATE: Adding a screenshot of the second dialog for the person who doubted what the second option says.