app-config

.NET own configuration file

僤鯓⒐⒋嵵緔 提交于 2020-01-01 05:25:08
问题 Is there any way that I could specify at runtime the configuration file I would like to use (other than App.config)? For example I would like to read a first argument from a command line that will be a path to the application's config and I would like my application to refer to it when I use ConfigurationManager.AppSettings (It's probably impossible but still it's worth asking). I did find this piece of code: System.Configuration.Configuration config = ConfigurationManager

.NET tracing in PowerShell without creating .config file

我的未来我决定 提交于 2020-01-01 05:17:18
问题 I know I can enable .NET tracing by adding <system.diagnostics> element to App config ( powershell.exe.config ) in PowerShell installation folder. This is covered in System.Net tracing in Powershell. In fact, I too want to log System.Net tracing source (e.g. FtpWebRequest). But is there a way to enable tracing locally? Like in the code itself? Or possibly using some command-line switch? Or can I at least have the App config file in a local folder, not to have to modify the system-wide

In monodroid or monotouch what should I use instead of app.config for configuration strings?

…衆ロ難τιáo~ 提交于 2020-01-01 04:19:20
问题 I want to store development vs production connection strings and configuration strings in a monodroid project. I would normally store it as app settings in a web.config or an app.config, but how should I do it in monodroid and monotouch projects? I would also like for it to switch configurations automatically between debug and release builds just as visual studio does with *.config files. In an iOS app I could store these in a plist but I'd like a cross platform solution in mono. How would I

Azure Worker Role Config File Transformations

大城市里の小女人 提交于 2019-12-31 22:00:25
问题 I've setup a new worker role and setup a couple of new config transforms for it via SlowCheetah. When I build the project with one of the new configs selected, I do in fact see that configs folder get created underneath the \bin folder as you would expect (for ex. \bin\Production). When I package a cloud service for deployment using one of the new configs, my web projects get their configs transformed appropriately but my worker role (which is just a library) does not even though I see

Using ConfigurationManager.GetSection in a Class Library's App.config

▼魔方 西西 提交于 2019-12-31 03:09:26
问题 I am writing a class library which has settings in its app.config and which will ultimately be called by a small number of other .NET applications. In order to get settings from it I'm using ConfigurationManager.GetSection such as this: MyConfiguration process = (MyConfiguration)ConfigurationManager.GetSection("MyGroup/processes"); I've discovered though that the calling application has to have the same app.config inside it's own project in order for this to work, otherwise the class library

How to get configuration element

我是研究僧i 提交于 2019-12-30 08:53:28
问题 Helo Can anybody explain me how to get configuration element from .config file. I know how to handle attributes but not elements. As example, I want to parse following: <MySection enabled="true"> <header><![CDATA[ <div> .... </div> ]]></header> <title> .... </title> </MySection> My c# code looks like this so far: public class MyConfiguration : ConfigurationSection { [ConfigurationProperty("enabled", DefaultValue = "true")] public bool Enabled { get { return this["enabled"].ToString().ToLower(

ConfigurationSettings.AppSettings is obsolete, warning

落爺英雄遲暮 提交于 2019-12-30 04:56:27
问题 var values = new NameValueCollection { { "key", ConfigurationSettings.AppSettings["API-Key"].ToString() }, { "image", Convert.ToBase64String(File.ReadAllBytes(photo.ToString())) } }; What's the new way to use the app.config file? 回答1: The ConfigurationManager class in System.Configuration : ConfigurationManager.AppSettings ConfigurationManager.ConnectionStrings So your code would change to: var values = new NameValueCollection { { "key", ConfigurationManager.AppSettings["API-Key"] }, { "image

Store user settings into application folder

半城伤御伤魂 提交于 2019-12-30 04:33:09
问题 I'm using setting from my C# application like this: String str = Properties.Settings.Default.SETTINGS_NAME; When I save this settings, a settings file is created on C:\Documents and Settings\<user name>\Local Settings\Application Data\<comp name>\Keb.exe_Url_pbs4eg1o2ija22omldrwjxhdam0jxxi5\1.0.0.0\user.config Is there a way to change this path to Application.ExecutablePath\user.config , and use it next time so my application can be more portable ? 回答1: You can control the location of the

Binding ASP.Net Web.Config Settings To .ASPX File <a href></a>?

家住魔仙堡 提交于 2019-12-29 07:06:36
问题 The Scenario I have an ASP.NET web project. I want to be able to define all of the links for the site inside my web.config file so that they can be changed easily if needs be. Currently I have an "" section in my web.config file. The Question How do I bind this key value pair to an '' tag in my .aspx file?! The App Settings in My Web.Config File <appSettings> <add key="MyNewLink" value="http://someurl.co.uk/" /> </appSettings> Help greatly appreciated. EDIT: Sorry I should have mentioned that

Why are application settings read-only in app.config?

烂漫一生 提交于 2019-12-29 04:31:06
问题 I have some settings in my app.config which I intend to be 'global' - ie. any user can change them, and all users get the same setting. But unless I change them to be user settings, they are read only. Why is this? And how should I go about persisting my app's global settings? Edit: This is actually a windows service application which runs as a service as LocalSystem. It can also be run manually by a local admin with argument "/config", which launches a windows form to edit configuration