dotnet / upgrade-assistant

A tool to assist developers in upgrading .NET Framework applications to .NET 6 and beyond
MIT License
1.11k stars 163 forks source link

Can not debug (or publish) a 4.7.2 Web App after upgrade #1562

Open Tim-Utelogy opened 5 months ago

Tim-Utelogy commented 5 months ago

I've worked my way through the build problems I had updating our existing .net framework web app to the new SDK style. However, I can't debug it or successfully run it in Azure after a publish. So I created a web project from the built in template and was able to reproduce the same issue. I know that going from 4.7.2 to 8, for instance, with a project that uses System.Web is perilous and there is a warning message to that effect, but I would have expected an in-place upgrade to work?

Microsoft Visual Studio Enterprise 2022 (64-bit) - Current Version 17.10.1

.Net Upgrade Assistant version 0.5.617.36348

Create a new Asp.Net Web Application (not Core) targeting .net 4.7.2, selecting "Single Page Application" image

Debug the application, using the default IIS Express profile. Everything works fine.

"Upgrade project features" using .Net Upgrade Assistant info: C:\Users\TimBertalot\source\repos\WebApplication1\WebApplication1\WebApplication1.csproj contains a reference to System.Web, which is not supported on .NET Core. You may have significant work ahead of you to fully port this project. info: 'C:\Users\\source\repos\WebApplication1\WebApplication1\WebApplication1.csproj' is a legacy web project and/or references System.Web. Legacy Web projects and System.Web are unsupported on .NET Core. You will need to rewrite your application or find a way to not depend on System.Web to convert this project.

Reopen the solution Attempt to recompile, it fails. Add assembly reference to System.Web.Routing and System.Web Add missing nuget packages: Microsoft.AspNet.Web.Optimization Microsoft.AspNet.Identity.EntityFramework Microsoft.AspNet.Identity.Owin Microsoft.Owin.Host.SystemWeb

Try to compile again, and now it fails because the upgrade has erroneously switched it to an Exe output from Library. Switch the output back to Library

Project now compiles without any problems.

Try to launch the debugger and get "Unable to run your project" presumably because its trying to run an exe image

Attempt to add a IIS Express debug profile, setting an app url like http://localhost:12345 Same error about RunCommand