locked
Hide Auto generated file in C# RRS feed

  • Question

  • Hi All,

    I want to hide the auto generated file in C#. Same way as it works in VB.Net.

    Tuesday, March 2, 2010 11:42 AM

Answers

  • Hello,

    AFAIK, C# and VB.NET behave in the same way to show/hide auto-generated files (code behind files, .designer files, etc.). there is a "Show All Files" button on the Solution Explorer toolbar that toggles the behavior. It is up to the user to decide whether to show/hide them. Actually it's a per-user, per-project (not per-solution) setting.

    Programmatically, you can use DTE.ExecuteCommand("Project.ShowAllFiles") to toggle the behavior for the selected project in the Solution Explorer, but the user can always change that.

    Bottom line: IMHO you shouldn't handle that.

    If I misunderstood something let me know.
    MZ-Tools: Productivity add-ins for Visual Studio: http://www.mztools.com. My blog about developing add-ins: http://msmvps.com/blogs/carlosq/
    • Proposed as answer by Carlos J. Quintero Wednesday, March 3, 2010 9:07 AM
    • Marked as answer by Chao Kuo Tuesday, March 9, 2010 2:39 AM
    Wednesday, March 3, 2010 9:07 AM

All replies

  • Hello,

    AFAIK, C# and VB.NET behave in the same way to show/hide auto-generated files (code behind files, .designer files, etc.). there is a "Show All Files" button on the Solution Explorer toolbar that toggles the behavior. It is up to the user to decide whether to show/hide them. Actually it's a per-user, per-project (not per-solution) setting.

    Programmatically, you can use DTE.ExecuteCommand("Project.ShowAllFiles") to toggle the behavior for the selected project in the Solution Explorer, but the user can always change that.

    Bottom line: IMHO you shouldn't handle that.

    If I misunderstood something let me know.
    MZ-Tools: Productivity add-ins for Visual Studio: http://www.mztools.com. My blog about developing add-ins: http://msmvps.com/blogs/carlosq/
    • Proposed as answer by Carlos J. Quintero Wednesday, March 3, 2010 9:07 AM
    • Marked as answer by Chao Kuo Tuesday, March 9, 2010 2:39 AM
    Wednesday, March 3, 2010 9:07 AM
  • Hello, Sahoo

    Do you mean hide the *.designer.cs?

    You could not hide the *.designer.cs file, as far as I know,  No way to hide them in C#.

    Thanks

    Chao

    Friday, March 5, 2010 6:16 AM