A few more Microsoft Visual Studio questions

Abdulqadir Aliyev 136 Reputation points
2023-01-06T17:47:26.79+00:00

So, before I install Microsoft Visual Studio anyway, I still got 2 questions left to ask.

1. PDB File
One Community Expert did tell me what a PDB file is, so no need to talk about what it actually does, and what is it used for. But, can I like delete the PDB and SLN (Solution) file(s)? Would this impact the usability and workings of my compiled executable, like as a result, making it unlaunchable?

2. Compiling a C# App with GUI
Let's say I make a program, which has a GUI (using Windows Forms). People tell me that I need to do more other than just selecting Build option to compile a C# App with GUI into an executable. But, if I have a C# project that has a GUI, can I simply build it like with a console app - Build -> Build, or I should do more than just selecting the Build button? It is a little bit difficult to explain about this

Developer technologies | Visual Studio | Other
Developer technologies | C#
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 90,686 Reputation points
    2023-01-06T18:15:45.053+00:00
    1. Don't delete the .SLN, it is the main file that you usually double-click to launch your project(s)...
      For .PDB, you can click on "Advanced..." button in Build Properties and select "None" to not generate them :

    276880-advanced-build.jpg

    For 2,
    I don't understand what you mean : if you select "Build" or "Rebuild", it will generate normally the .EXE, for Console or GUI app...

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Lex Li 6,037 Reputation points
    2023-01-07T19:07:45.577+00:00

    Not surprised to see that you are relatively new to the platform, based on how you wrote the questions and what kind of answers you accepted. Every time you learn a thing, please try to build up more contexts around them.

    PDF Files

    While you claimed that you know what a PDB file is, what it actually does and what it is for, then by asking "can I like delete the PDB" indicates that you didn't really know much. You might be astonished to learn that many .NET based products (like JetBrains ReSharper) ship PDB files even when their assemblies are release builds. The most common reason behind is that they are collecting diagnostics data and with PDB files the data can be more accurate (exception call stacks can contain even line numbers).

    Like @Castorix31 explained, SLN files are another kind.

    Ambiguous Statement

    "People tell me that I need to do more other than just selecting Build option to compile a C# App with GUI into an executable" then did you ask under what context you should follow that and why? If they cannot explain fully the reasons behind a recommendation, don't follow it blindly and sometimes don't even waste your time to remember that.

    .NET has been there for two decades, and changes rapidly in the past few years due to .NET Core evolution. So, old school knowledge can be deprecated.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.