Visual Studio doesn't recognize windows form as form anymore (no designer view)
Since one of the newer updates, visual studio now checks for the target .Net version and according to documentation only shows the forms designer for projects targeting .Net 8 or higher.
If I create an entirely new winforms project with target version .Net 8 or migrate an existing < 8.0 project to 8 (or even 9), the designer won't open and also vs doesn't recognize the form as such anymore (see attached image).
Did anyone else have this issue before and found a solution to get the designer back?

47 Replies
* close VS
* remove the hidden folder
.vs
* remove all bin
and obj
folder next to each csproj (DO NOT TOUCH THE .git
FOLDER OR WHAT'S INSIDE)
* restart vsShare your csproj @h3x4by73
Here's the csproj content:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>
that usually happen when u add classes on top of the main form class
so u lose the ability to open the designer
can u post the content of form1.cs
preferable use the site below to $paste
If your code is too long, you can post to https://paste.mod.gg/, save, and copy the link into chat for others to see your shared code!
as I wrote in the starting post - there is really nothing special within that form, it even happens when I create a blank winforms project without adding any custom code at all. But here's the content:
https://paste.mod.gg/izzfbdknxhrd/0
BlazeBin - izzfbdknxhrd
A tool for sharing your source code with the world!
very weird indeed, have u tried repairing your visual studio install by going to the installer

I did a full reinstall, nothing changed
and can u show the workloads u have selected in the installer
interestingly if I create an empty project targeting .net 9 it works
sounds like u might have something in conflict causing the issue tbh
but only if I select .net 9 as target when creating the project. If I change it later on it doesn't work. I also compared all the files (sln, csproj, csproj.user), even if they're exactly similar for the .net 9 project it works right away, for the one started with 8 it doesn't
anyway can u show me what workloads u have selected in installer
those are my workloads

and also run a dotnet --info
and are u running a preview or stable version or visual studio
dotnet --info: https://paste.mod.gg/abazlsjmbfzm/2
BlazeBin - abazlsjmbfzm
A tool for sharing your source code with the world!
according to the installer I have version 17.13.6 installed. I did not manually select any preview version
this looks fine
mmm so to review the case if u create winforms with .net9 it all works
if u modify the csproj to .net 8
it all breaks
it's the other way round
didn't try to start with .net 9 and switch to 8 then yet
you said above if u start with 9 it works so that got me confused
ok let me write it down again:
starting with net 9 works
starting with net 8 doesn't work
starting with net 7, then upgrading to 8 didn't work either. upgrading from 8 to 9 still didn't work
ok so everything works except 8?
i just tried starting with .net 9 and switched to .net 8, for some reason this way it works
yeah that is very weird indeed because the only change in that case is in the csproj
the templates are the same I imagine
ok what if u create a project on .net 8
then right click and build
does it build successfully despite not opening the designer
well now things starting to get really strange. For some reason creating a .net 8 worked this time. What the hell
:bigthonk:
that makes me think you're having some memory issue or some hardware related issue causing this weirdness
Check Event Viewer for anything suspicious
and perhaps run a memory check(MemTest86) to ensure its good
it might be that it changed after reinstalling and i only tried the other way after reinstalling
I mean sure but none of the cases u listed would cause the designer to break
the main problem why this occured to me was that I have a .net7 project which then gave me the warning from vs that since support is dropped for .net 7 now also the designer won't show up anymore. So I tried upgrading and since then the designer broke for that project and I kept getting strange behavior from the designer
and after that even the templates didn't work anymore for me
mmm I dont think it would break just because its out of support, but still the only thing u would need to change is the version in the csproj
assuming its a clean winforms project
ofc if u have an actual project there might be libraries and whatnot u would need to update along
creating a new .net 7 winforms project gives me this warning in the designer:
When i first had this warning and closed the designer, all my forms proceeded to not be loaded in the designer anymore

it says in future versions the designer will not load anymore for .net 7 projects
I see, indeed.
but it would still be a matter of updating the csproj to a newer version
and then just reloading the project
well I tried exactly this but it simply doesn't recognize the forms as forms. It groups them together correctly but that's it
the icon remains the icon of a normal c# file
and the context menu gives no possibility to open the designer
you change from 7 to 8 in the csproj, save, close the solution and then open it again?
i changed from 7 directly to 9 but apart from that, yes
what if u delete the bin and obj folders
before u open it again
does it go back to working
I did a quick test here but im on preview version of visual studio, changing it to 7 completely breaks the designer from opening, it doent change the icons or anything and I have to right click project, clean, change to 9, close vs and open it again
but it all worked fine after that
i tried deleting obj and bin and clearning but still same result
anyway I need to get some sleep. Thank you very much for your help, I'll give it another go tomorrow
it's a VS bug
it does it from time to time
tf is the bot doing
bot loves u
@Patrick bot gone crazy, any message some one sends it does this triple message(looks like its fixed now but it was doing it in any channel)


anyway deleting
.vs
sometimes helps with this@h3x4by73 give that a try before u go if u can
tried this already a few times. I can try again after the clean now, sec
nope, still unchanged. Thanks anyway
The out-of-process WinForms designer remains a preview if you read relevant documentation again. So, please use
Help | Send Feedback | Report a Problem...
to report such issues.