I have been migrating a .NET Framework 4.8 website over to .NET6 so far it's working, I have two branches for this in my Git repository one for the old one for the new.
This is where the problem seems to happen. If I switch back to the .NET Framework 4.8 branch, it of course overwrites the files with that branch and when I am done move back to the .NET6 branch and after that if I rebuild and run my site I get this exception on run:
System.InvalidOperationException: 'Cannot find compilation library location for package 'runtimepack.Microsoft.Windows.SDK.NET.Ref''
One of the libraries that the web project references uses Windows calls so the TFM is set to net6.0-windows10.0.17763.0 right now. When the site runs inside VS after this branch switch that exception above happens. If I find the host app in the compiled folder and run it manually it runs fine with no exceptions.
When I run it from the build folder manually, I can also attach the VS debugger to it fine and it still works without throwing the InvalidOperationException exception...
What would cause this exception to happen if I launched from inside of VS using a Kestrel host vs running it manually by executing the host app executable then attaching the debugger?
Even odder, I previously fixed this and I'm not sure how I deleted temp files, cleared OBJ and BIN folders and it worked... tried that again this time and nothing