create visual studio solution and include settings of the applicatioon - c#

I am building a C# application. it has some parameters saved of a file named "settings.ini" .
Of course, I managed my application to read settings ,offer an interface for editing them and finally save them back to the ini file.
Would you please tell me how to include this setting file to the installation package (VS2008)
Thanks.

Instead of using an ini file, you should be using a .config file - that's the normal configuration option for .NET application with quite a lot of built in support.
You should be able to add an app.config file to your project from the new item screen in Visual Studio.
Take a look at Configuration Files on MSDN for more detail and the AppSettings class (this page includes some examples).

Related

Adding app.config (Application Configuration File) in Visual Studio Professional 2017

I can't get the Application Configuration File template to show up under my Add > New Item > Visual C#. I've run a repair. I've uninstalled and reinstalled. I've deleted and added Cache folders. I've run devenv.exe /InstallVSTemplates. Nothing is working.
If anyone can tell me specifically what installation elements I should be including, and specifically what type of Project I need to start that might help.
I want to create a simple .Net Web Form in .Net and C# and need to include an app.config file.
When you create a new project (depending on the type of project like a web application for example) it will automatically create a template app.config file.
Worst case just make a txt file in notepad and call it [Appname].config
Another way would be to go in the project properties, then the Settings tab. If there are no settings yet, a link should exist in the middle of the empty tab to create a default setting file. Add one Application or User setting and save. Among other things a config file will be created for you too.

c# installer project with external file

I have created an application in which every installation is differed by the configuration file.
Currently the configuration file (settings.setting) is part of the installer itself.
Is there a way to create an installer without the settings.setting embedded inside it, so will have the setup.exe and a separate settings.setting file?
(So will have 1 installation build, and the installation will copy the setting file to the relevant location as done if it is part of the installation build)
Thanks,
Yoav
Maybe you should try to extract the config file to another file and link it from default config file.
MyApp.exe.config would containt a line like this:
<appSettings configSource="pathtoconfig\MyExternalAppSettings.config" />
Here's a good blog post on this subject.

How to disable log4net.xml file generation

I'm trying to use Log4net for my c# application. But when my application runs it generates log4net.xml file. As I read , It includes some information related to use in .NET documentation . But I no need this file or documentation.
How to disable log4net.xml file generation.
Your application is NOT generating this file. This file is part of the Log4Net project alongside with the assembly (log4net.dll) and the public debugging symbols (log4net.pdb). Those file are simply copied to your application's output directory. If you don't want to have them (even though it is strongly recommended to keep them), you could remove them from the source.
If on the other hand you downloaded the source code of Log4Net and compiled it yourself, then you could disable XML documentation generation in the properties of the project. In this case no log4net.xml file will be emitted.
If you are using log4net project from NuGet, remove log4net.xml file from the packages folder that was created by the NuGet(that file is under the /lib/<.net framework version>) and it will not get copied to your output.
Open command prompt as administrator
cd C:\WINDOWS\assembly\GAC_64\log4net\1.2.10.0__692fbea5521e1304
Rename log4net.dll 64bit to log4net64.dll
Copy log4net.dll 32bit to folder
C:\WINDOWS\assembly\GAC_64\log4net\1.2.10.0__692fbea5521e1304

Configuration file in .net windows application

I am new in .net.
I am actually converting a Console application into Windows application in .net. And I want to include some configuration files in the windows application.
I know that for web application there is Web.config and for Console application there is App.config to have the configuration details.
But I don't have any ideas about the configuration file in windows application. I have to include the configuration details in my windows application that included in the console application that i want to convert.
UPDATE
Problem Fixed.
It is a fault from my part. I also copied startup tag. Can anyone please tell me for what this tag.??
Thant you all for the replay.
A windows application is a WinForms or WPF application and use the same App.Config renamed in yourappname.exe.config as in Console Applications. So just go on with that
An excellent series of articles on configuration files (I will dare to say the reference)
Unraveling the Mysteries of .NET 2.0 Configuration
Go to the project's properties and change to the "Settings" tab. You might see a message that no settings file is present right now. If you click the link, one will be created.
Add one setting as a dummy so that all sections in the app.config file are created (<applicationSettings> or <userSettings> and the respective section for your namespace). Then, open the original config file in a text edit, copy the settings lines (not the lines containing the <namespace.properties.settings> start and end tags) and then paste them into the new app.config. Make sure that you copy application settings to the <applicationSettings> section and user settings to the <userSettings> sections accordingly.
The next time you open the Settings tag, you'll be asked whether you'd like to import the new settings.
There’s a really simple way to do this.. simply go to the File \ Add New Item menu, or hit Ctrl+Shift+A
You’ll notice that it’s already set to App.config for you. Just hit the Open button.
If you look in the Solution Explorer, you will see that the config file is in your project:
Now build your application, and take a look in the \bin\debug\ folder. You’ll see that the configuration file has automatically been generated and named correctly for your executable:
Reference taken from HERE
Right click on your project go to -->Add --> New Item and then you will find a dialog as shown

app.config configSections custom settings can not find schema information

I am just learning about app.config in respect of creating custom sections. I have that part working, it compiles and gets the information out as required but I get warnings about it could not find the schema information.
I have done a bit of googling and could not find a simple explanation of this situation.
The approach (that seems to make sense to me at the moment) would be to have a schema file for each section within that project. I understand how to create a schema file, but do not know how I would like this into the project.
Also when it is compiled and deployed to another machine I presume that schema file would need to be copied across as well.
Thanks for any and all help
Jon
Try linking the app.config file to the corresponding schema (ussually you can find it on C:\Program Files\Microsoft Visual Studio 8\xml\Schemas\DotNetConfig.xsd) ,to do so just open the app.config file in visual studio, open the properties window (F4) and put the path above to schemas.
Pablo.

Categories