C# .NET - Cannot see app.config file on project

Asked By Michael Parker on 04-Dec-06 02:05 PM

Hi,

Why would i not be able to see this ?  It is a standard WinAPP, but I am looking for app.config, and can't find it anywhere.

I tried Project->show all files of course, but no luck there.

There is likely a simple thing that I am missing ?

Application Configuration File - F Cali replied to Michael Parker on 04-Dec-06 02:14 PM

If it is not there, you can easily add it by right-clicking on your project then selecting Add --> Add New Item then select Application Configuration File in the templates.  The file might have been accidentally deleted that's why it is not there anymore (assuming it was there before).

Okay -- I assumed that this file would be standard with each project. It is not?

Michael Parker replied to F Cali on 04-Dec-06 02:20 PM
end of post

I don't see an option for Configuration File or Application Configuration File

Michael Parker replied to F Cali on 04-Dec-06 02:27 PM

Are you sure this is the way to add it?


I looked on another project which has an app.config, and in the add item menu, it doesn't have an option for adding a config file either.

Not standard - F Cali replied to Michael Parker on 04-Dec-06 02:34 PM
Since not all windows application will make use of an app.config file, it is not automatically created when you create a new project.
Template - F Cali replied to Michael Parker on 04-Dec-06 02:40 PM

If this is for .NET 1.1, it should be somewhere at the end of the list of Templates when you click on the Add New Item option.  Right-click on your project, select Add then Add New Item.

.Net 2.0 I tried to get around this by adding an xml file and nameing that app.config but
Michael Parker replied to F Cali on 04-Dec-06 02:57 PM

I don't think that is working. Ultimately, I am attempting to set a connection string for my Enterprise Library connection.

I think that the app.config will be my solution to this, but like other solutions this is eluding me for EL setup...

If your app is an executable (console or Windows Application) - Peter Bromberg replied to Michael Parker on 04-Dec-06 03:01 PM
then the template for an app.config file should be findable. If not, then your templates have gotten mangled somehow. you can always borrow one from somewhere else and include it into the project. This is copied to the runtime folder as "yourappname.exe.config" after a build.
Weird - F Cali replied to Michael Parker on 04-Dec-06 03:02 PM
That's weird because I also tried it in VS.Net 2005 and I see it in the list of templates.  Make sure that you right-click on the project and not on the solution.  You won't find it in the templates list if you right-click on the solution.
App config was not locatable, but i created a newfile and named App.config now
Michael Parker replied to Peter Bromberg on 04-Dec-06 03:15 PM

I am attempting to use the new app.config file to duplicate the methed that EL tutorial code has used for connecting to sqlserver. My connection isn't working, so I put a code break in my app.config file.

Since this code break is never accessed,  I am assuming that app.config is never reached. I will review more to ensure that I am calling it correctly.

Thank you for all this input...

app.config appears in vb.net windows app - sundar k replied to Michael Parker on 05-Dec-06 12:21 AM

When you open a new Project using VB.net Windows Application and if you add a new item, i am able to see app.config listed,

but its not getting listed for c# windows application, may be browse and add app.config as existing item( since its another xml file )