question

MosheRubenstein-1725 avatar image
0 Votes"
MosheRubenstein-1725 asked DuaneArnold-0443 edited

Visual Studio 2019 missing class View designer

Hi
In Visual studio 2019, Framework 4.72 I have a big solution with several asp.net webforms websites.
I added the following class to two websites: In the solution explorer, in one website, in the context menu, I have "View designer", and in the other website, there is no "View designer". If I click "Open With...", in the list of viewers, one has "CSharp Form Editor" and in the other website it is missing.
Any ideas?


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for Class1
/// </summary>
public class Class1 : System.ComponentModel.Component
{
public Class1()
{

 }

}



dotnet-csharpdotnet-aspnet-webforms
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

cooldadtx avatar image
1 Vote"
cooldadtx answered

You'll only see the View Designer option for files that the IDE considers to have designer files. This is tied to how the item is added to the project. If you added the file using Add New Item then it was likely inserted (along with the .designer.cs file) into the project and in the project file there is a subtype set identifying it as having a designer. If you simply copied the file to another project and added existing item on it then that information wouldn't be available so you'd need to manually do the same thing. More importantly you'd need to ensure you copied all the files related to the component (if any).

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MosheRubenstein-1725 avatar image
0 Votes"
MosheRubenstein-1725 answered cooldadtx commented

Hi @cooldadtx
Thank you for your answer.
Actually, in both websites (where the designer shows, and where it doesn't) there is no designer file. As you can see, it is an empty class. I created the file (Add...) in the website where it does not work and copied it to the website that it does work...

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Open the project file in a text editor where it works. Does that particular file have a subtype listing it as a component? Then go to the project file where it doesn't work and check again. I suspect it doesn't have the subtype.

0 Votes 0 ·
MosheRubenstein-1725 avatar image
0 Votes"
MosheRubenstein-1725 answered cooldadtx commented

@cooldadtx
I don't know of a project file, it is a website (so is the other one)
This is the vwd.webinfo content:
<?xml version="1.0"?>
<!--
Visual Studio global web project settings.
-->
<VisualWebDeveloper>

<iisExpressSettings windowsAuthentication="enabled" anonymousAuthentication="enabled" useClassicPipelineMode="false"/>
</VisualWebDeveloper>

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Ouch, I didn't even think VS supported websites anymore. I'm not sure how to convey subtype information in a website because VS figures things out based solely on the file contents. The fact that you derive from a component is what it uses to determine whether that option is available or not. Out of curiosity, if you change the base type to UserControl for a minute do you suddenly get the designer option?

0 Votes 0 ·
MosheRubenstein-1725 avatar image
0 Votes"
MosheRubenstein-1725 answered

Hi @cooldadtx
The exact same class shows in the designer in two other websites in the same solution.
I tried removing the inheritance - no difference.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DuaneArnold-0443 avatar image
0 Votes"
DuaneArnold-0443 answered DuaneArnold-0443 edited

https://docs.microsoft.com/en-us/answers/products/vs

Maybe, you can try a Visual Stuido forum.

The link is in the above parent link.

https://docs.microsoft.com/en-us/answers/topics/vs-general.html

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.