Graphical application.config editor? - c#

I am wondering if .net has some sort of inbuilt gui for editing application.config files.
From googling around it seems that they exist but are designed to be run from visual studio.
What I want to do is to allow admins of the software I am writing to be able to customise the application config from within the software at a customers site.
Could someone advise me if this is possible?
At the minute I thinking I will have to wite my own code to parse the config files to generate the Gui.

Create your own form whcih takes application.config values from user and update that in the application.config

Related

Update app.config file after installer upgrade

I'm currently working on a Microsft Word Application-Level Add-in using C#. My application contains an app.config file. In this file I save user-settings (userSettings-Section) and some data defined by a custom ConfigurationSection. The data stored inside of custom ConfigurationSection is also user-specific.
I access the user-settings as follows:
Properties.Settings.Default.MyUserSetting
The custom ConfigurationSection I'm using like:
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal)
.GetSection("MyCustomConfigurationSection")
My questions are:
Do I even use the app.config the "correct" way? (I know that there is probably not only one correct way, but is "my way" one of these?)
Which ConfigurationUserLevel does Propeties.Settings.Default use? Is there a way of setting/changing it?
And Most importantly: Is there a way to automatically keep the user-specific settings during an upgrade of my application, but at the same time add newly created settings?
I deploy my Add-in using an installer built with WiX. At the moment I use CustomActions, which manually insert code for each added/removed/changed setting. But I was wondering whether there is a built-in way of doing this.
I did some researches the whole day now and I think I can answer my questions for myself:
Q: Which ConfigurationUserLevel does Propeties.Settings.Default use? Is there a way of setting/changing it?
A: It seems that Propeties.Settings.Default use ConfigurationUserLevel.PerUserRoamingAndLocal, what sounds logical as they only contain userSettings... I don't know whether it is possible to change it, but for me it is not necessary.
Q: Is there a way to automatically keep the user-specific settings during an upgrade of my application, but at the same time add newly created settings?
A: I found out that there is an Upgrade()-Method in Settings which should take care of copying user settings between an older version of the product and the new one. For more information see http://ngpixel.com/2011/05/05/c-keep-user-settings-between-versions/. I must confess that I haven't had occasion to test it, since I have no permissions to build the installer, but I will rely on it. I will come back to this post after I tested my solution.
Furthermore I am not using a custom ConfigurationSection any more. Instead I derive from System.Configuration.ApplicationSettingsBase, which means that I am able to handle the custom data exactly like the Properties.Settings, including the Upgrade()-Method. See this post for more information about how to use it.
Hope this helps somebody.

Code generate new C# project

At the moment I am using C# T4 code generation, but as much as I know it is limited to a class file or other file type generation. I need to generate multiple projects in one solution is it possible to accomplish with T4 templates or there is other technique do to this?
Templates in Visual Studio allow for multiple projects / files templates so you can definitely create this.
The way to create them is simply to setup the skeleton you need for the project, then replace the content of the files in the directory with specific values that will be replaced when the template has the information needed.
I had similar experience.
I developed a whole set of T4 templates to generate a solution. But once you want change code in multiple files, some code may mess up.
So I wrote a code generator based on database schema to generate a VS solution with DAL(Linq To SQL, Entity Framework), BLL, WCF, and UI Applications MVC, WPF, Windows PHone, Windows App Store, Silverlight.
You can goto https://github.com/ntierontime/Log4Net to see whether it meets your architecture requirements, or not. And send me an email with the .dbml(Linq To Sql Classes).

Add languages at runtime

I have a multi-language windows application that uses standard .net localization in resx files.
Now I have a request to add a possibility for user to create his own language files that are not originally supported and add them to the application without recompiling it.
What's the best approach to achieve this?
I'm considering moving the languages to database and then crating a second tool that'll add translations to the database, but would rather keep the current approach, if it's possible to add resx files dynamically.
This is exactly why I don’t use .NET localization but wrote my own.
I store the translations in files separate from the EXE, have a Windows-Forms-based GUI for translation that I can embed in any application (and working on a WPF clone of it), and allow users to switch languages without restarting the application.
I don’t get why anyone would want it any different and why Microsoft created such a bad and limited system.
Unfortunately, I cannot publish my system right now, but I’m hoping I’ll be able to soon.
One option you can use is keep the translations in an XML file. This way, the user can just drop his own XML file into the folder where the translation exists.
You could write the translations to .resx file and just add the location of that file to the database and then when you want to translate some label just go to the database to see where that file is and then read from it. I'm not sure though how it would fit with a localisation lib...

Generic user interface for editing C# application configuration files

I am developing some little tools in C#, basically they just work fine as a console application with some configuration values read from the exe configuration file (System.Configuration).
But editing an XML file is not what you could call a great User Experience, so I am searching for a tool/library that could create a simple configuration screen in WPF or Winforms for the user to change these values.
This should be possible to automate for many simple cases. I did not find any existing tools that could solve this problem. Does anyone know tools that create UIs for configuration files or any tools that could speed up the creation of such a tool?
It should not be a problem to create this in pure WPF, but any tool to speed up the process is welcome.
ASphere is a freeware XML configuration editor.

How do we can create the attractive/customised installer for our .net application?

I am usually using Setup and Deployment template provided by visual studio. Is it possible to enhance default forms provided in that. or is there anything else to create the customized and attractive installer.
Aim :
1. I like to ask the user for pre-requested information to initialize the application during the installation process.
2. I like to prevent app.config by toching from user.
3. I like verify the collect the connection information during installation as well as like to verify that by connecting with given data source.
please provide good direction if i am in wrong path. - thanks
Wix is what you need
Yes, you can do all these things with the built in setup project in Visual Studio.
You can add a new user interface dialog box with text boxes, check boxes etc.
Write a custom action the handles these values and store them in some configuration file.
The app.config shouldn't be touched by the user anyway. If you are using the built in configuration classes in .NET, the user settings will be stored in a separated file in the user's application data folders.
As in #1, you can use custom actions for this kind of functionality.
The built in setup project has very little/no means of customizing the look and feel. For that you will have to use either 3rd party components/installers or use WiX and design setup screens/dialogs by yourself.
I use Inno Setup (http://www.innosetup.com/isinfo.php), its free and very configurable, it can also run your own applications as helpers to do very specific tasks.
Why not try other install systems like InstallShield or, if you really want to customize go for NSIS (Nullsoft Scriptable Install System)? NSIS Download

Categories