Why do some C# applications have an app.config file and others do not?

1 Answer 784 Views
General Discussions
William
Top achievements
Rank 1
William asked on 24 Jan 2024, 11:18 PM

Why do some C# applications have an app.config file and others do not? Both of these solutions were initialized as Visual C# Windows Form Applications.

This one I created in Visual Studio Community version:

This screen capture bit is from a youtube tutorial. I followed along with the instructor in the video and He created it with a menu selection as a Visual C# -> Windows Form Application.

I tried following along with the tutorial and I noticed that the instructor's IDE, Visual Studio Community version, had a Solution Explorer that included the app.config file. I am curious and concerned because I believe system settings can be entered into the app.config file and so his code will be different from mine and my code might not even run at all.

 

1 Answer, 1 is accepted

Sort by
1
Dinko | Tech Support Engineer
Telerik team
answered on 26 Jan 2024, 08:20 AM

Hello William,

Thank you for reaching out to us.

The project in the first image is targeting .Net Core while the project in the second image is targeting .Net Framework. With the release of MS .Net Core projects, the App.config file is not included by default when a WinForms application is created. However, that does not mean that you can't add it afterward. When you start to create a project you can observe two templates.

The first template targets .Net Core while the second one will target .Net Framework. When you choose the first template you can see the target framework drop-downs that it does not contain .Net Framework versions.

If we choose .Net 7 for example, you can click on the Add New Item from the Project context menu.

Then you manually add the Application Configuration File (App.config) file.

I hope that you find this information helpful.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

William
Top achievements
Rank 1
commented on 12 Jul 2024, 02:35 PM

Very good.

Very helpful.

Much thanks.

Tags
General Discussions
Asked by
William
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or