Visual Studio 2019 missing class View designer

Moshe Rubenstein 1 Reputation point
2021-04-22T12:14:00.11+00:00

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()
{

}

}

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,243 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,197 questions
0 comments No comments
{count} votes

5 answers

Sort by: Most helpful
  1. Michael Taylor 47,711 Reputation points
    2021-04-22T13:52:21.317+00:00

    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).

    1 person found this answer helpful.
    0 comments No comments

  2. Moshe Rubenstein 1 Reputation point
    2021-04-22T13:58:02.023+00:00

    Hi @Michael Taylor
    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...


  3. Moshe Rubenstein 1 Reputation point
    2021-04-22T14:05:16.687+00:00

    @Michael Taylor
    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>


  4. Moshe Rubenstein 1 Reputation point
    2021-04-25T05:58:47.353+00:00

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

    0 comments No comments

  5. Duane Arnold 3,211 Reputation points
    2021-04-25T17:07:36.773+00:00

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

    Maybe, you can try a Visual Stuido forum.

    The link is in the above parent link.

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

    0 comments No comments