.net upgrade assistant added net7.0-windows for asp.net MVC webapplication during migration

Tanuja Valluru 40 Reputation points
2023-01-31T05:24:17.76+00:00

When I used .net upgrade assistant tool convert my webapplication with asp.net MVC with .cshtml views of .net framework 4.8 to migrate to .net 7 then the tool included .net 7-windows as the target framework. this is the same case for projects of type library .
but my application is not using WPF or windows forms.

Tool suggested webapp first and automatically WPF and added above.

I agree output type is console application.
But when I am not sure if
 <TargetFramework>.net7.0-windows</TargetFramework>
 because when I created new webapplication it 

So, I removed window and changed to .net6.0. and builded the migrated webapp, I got below error --

Error details -NETSDK1136
The target platform must be set to Windows (usually by including '-windows' in the TargetFramework property) when using Windows Forms or WPF, or referencing projects or packages that do so.  C:\Program Files\dotnet\sdk\7.0.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets  line - 146

<NETSdkError Condition="'$(TargetPlatformIdentifier)' != 'Windows'" ResourceName="WindowsDesktopTargetPlatformMustBeWindows" />

above error is for all project including library and startup project, I see same error referring to same line 146 for all projects. Please let me know what can be done. I followed steps mentioned on the .net upgrade assistant on Microsoft website. My present project is not using WPF.

my application is not using WPF.

I request you please help as this is not on my project but at sdk level. I am not sure if this may any deployment issues in production on cloud environments
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,158 questions
{count} votes