app-config

Accessing the settings (app.config) of the calling application

痞子三分冷 提交于 2019-12-24 12:44:15
问题 I have a WinForms application ("WF"), and a Library called by that WinForms application ("LIB") WF has a Settings.settings (Visual Studio Designer) and app.config combo. I gather than the designer is a front end that auto generates the app.config file. To use those settings from within WF, I use the strongly typed properties of the class it autogenerates (i.e. WF.Settings.MyTimeOutSetting). When WF calls a method in LIB, I want to use one of WF's settings from within lib. How can I retrieve a

How to write connection string when ms access database is password protected?

◇◆丶佛笑我妖孽 提交于 2019-12-24 12:05:50
问题 My Code is <add name="conn" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Db\abc.mdb"/> My Database Password is 123 How to write full connection String? 回答1: Example as per connectionstrings.com: Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccessFile.mdb; Jet OLEDB:Database Password=MyDbPassword; Add this to the connection string according to the requirement. Ref: https://www.connectionstrings.com/access/ 来源: https://stackoverflow.com/questions/32152542

Create an app.config for an Assembly

◇◆丶佛笑我妖孽 提交于 2019-12-24 11:21:27
问题 I have a .NET assembly for a COM-visible component that I want to use some configurations. I know that applications use the app.config, but is it a violation of best practices to create and use an app.config for my assembly?? 回答1: My understanding is that if when you build the assembly, you have an app.config file then it will be turned into assmeblyName.dll.config by the compiler. If this present in the same directory as the assmebly at runtime, then it will be loaded whenever you try and

Editing app.config in execution time using the same App

ぃ、小莉子 提交于 2019-12-24 09:49:15
问题 I have an Windows Forms application VS 2008 - C#, that uses app.config. In execution time, in Menu option of my application, I want editing values of app.config, save it and restart application. any sample source code, any good patterns and practices ?? edit: in MSDN Forums, Jean Paul VA: Create an test windows forms application and add an app.config into it. Add reference to System.confguration Add a key named "font" in appSettings with value "Verdana" Place a button on form and on click of

App.config only for my developer machine

我怕爱的太早我们不能终老 提交于 2019-12-24 08:27:41
问题 Can I create app.config or web.config file that applies only to my developer machine, as opposed to using the default configuration files that are checked into source control? 回答1: You can have an app.config for each environment, if is this what you are looking for. Try this: http://www.hanselman.com/blog/ManagingMultipleConfigurationFileEnvironmentsWithPreBuildEvents.aspx 回答2: I would recomend using separate config files that are referred to by your app.config or web.config. For example in

.NET - Storing An App.config With A Class Library

非 Y 不嫁゛ 提交于 2019-12-23 18:13:06
问题 This seems to be asked a lot on the internet, but so far my research hasn't produced a solution. (And, at least for now, I haven't accepted "it can't be done" as a solution.) At its simplest description, what I'm trying to do is have a config file in a .NET class library project that is available to that class library in any application that references it. My setup can be simplified to 3 WCF services sharing some domain logic. One of the things they share is an injected dependency of a logger

What should I change when the compiler tells me to “Consider app.config remapping” when I have no app.config file?

喜欢而已 提交于 2019-12-23 12:47:55
问题 In compiling a solution ported from .NET 1.1 in VS2003 to .NET 3.5 in VS2008, I get several suggestions, of which this one is representative: Consider app.config remapping of assembly "System.Windows.Forms, Culture=neutral, PublicKeyToken=969db8053d3322ac, Retargetable=Yes" from Version "1.0.5000.0" [] to Version "2.0.0.0" [C:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v2.0\WindowsCE\System.Windows.Forms.dll] to solve conflict and get rid of warning. Neither project in the

WCF config files - and the famous “string content length quota (8192)” error

北城以北 提交于 2019-12-23 09:26:43
问题 Folks, Thanks for your help with my previous WCF config file issue. Here's a new one. My project is a WinForms app client (.NET 4.0) that pulls data from (and saves it to) a WCF services hosted on IIS 7.0. When I save a small payload, all is well. When I try to save a payload over 8192 bytes the error is: The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:objEncounterType. The InnerException

App.config seems to be ignored

妖精的绣舞 提交于 2019-12-23 09:04:29
问题 I've this Class Library, as a result of a refactor action. I added an App.config file and added something like this: <configuration> <connectionStrings> <add name="MyDatabase" connectionString="Data Source=server;Initial Catalog=database;User ID=userid;Password=password" providerName="System.Data.SqlClient" /> </connectionStrings> </configuration> But when I run the application, debugging learns me this is totally ignored. The immediate window tells me: ConfigurationManager.ConnectionStrings

ConfigurationManager.AppSettings - Returns Null

≡放荡痞女 提交于 2019-12-23 08:07:12
问题 Im trying to read settings from my app.config and im sure it was working before but now it returns a nullReferenceException. My code getting the settings is as follows: codeValueUtilRx = ConfigurationManager.AppSettings["CODEVALUE_UTIL_RX"].Split(';').ToList(); My app-congfig is as follows: <appSettings> <add key ="LOGFILELOCATION" value ="C:\\RuleEditor\\"/> <add key ="CODEVALUE_UTIL_RX" value="GCN;GRP;NDC;SPEC;TCC"/> </appSettings> I have a feeling its something seemingly obvious, I just