app-config

Visual Studio/MSBuild copy referenced class library's app.config as *.dll.config to bin folder of current project

♀尐吖头ヾ 提交于 2019-11-28 07:47:22
I have a class library that is referenced by many other web application projects. It has many settings in its app.config that I wish to use in all of the referencing web projects. When the class library is built, it copies the app.config to its own bin folder as <assembly.name>.dll.config . How do I ensure that <assembly.name>.dll.config is copied to the bin folder of each of my referencing web application projects? Visual Studio / MSBuild does not seem to do this by default. Changing Copy to Output Directory or Build Action (in any combination) does not work. SlowCheetah VS extension appears

How to create a file in the AppData folder using log4net

一曲冷凌霜 提交于 2019-11-28 07:06:24
问题 How to create the log file in appData folder. The path is C:\Users\MYNAME\AppData\Roaming\Project\My Project\Application. As soon as my project starts, the project folder is created on this path where this path is hard coded. How can I add my log file in this folder using log4net? I have made changes in the config file <?xml version="1.0"?> <configuration> <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/> </configSections> <log4net>

Couchbase multiple buckets in .NET app.config

喜欢而已 提交于 2019-11-28 05:50:41
问题 Couchbase .Net manual says that I can configure my client in this way: <couchbase><servers bucket="default" bucketPassword=""> <add uri="http://192.168.0.2:8091/pools/default"/> <add uri="http://192.168.0.3:8091/pools/default"/> </servers></couchbase> Is there any way to define sevral buckets in app.config and then switch between them in my app? 回答1: According to John's suggestion, I used such configuration: <configuration> <configSections> <sectionGroup name="couchbase"> <section name=

how to define a connection string using an app.config file in C# [duplicate]

ぃ、小莉子 提交于 2019-11-28 04:42:41
问题 This question already has answers here : Get connection string from App.config (18 answers) Closed 5 years ago . Currently i manually define my connection string in my C# code: string ConnectionString = "Data Source=C;Initial Catalog=tickets;Integrated Security=True"; SqlConnection Conn = new SqlConnection(ConnectionString); Conn.Open(); In my project i have an app.config file and i can see that it has a connection string. It looks like this: <?xml version="1.0"?> <configuration>

Run service with administrator privileges

前提是你 提交于 2019-11-28 04:32:59
问题 I am developing an application that runs as a windows service. I really need the service to have administrator privileges. I tried with the LocalSystem user, and it does not have enough rights. Is this possible? I tried setting requireAdministrator in the app.config. When I do this, the service starts and then immediately stops. I have tried with other administrator accounts as well, but I get the same results. 回答1: You just need to run it as an admin user - set the login correctly in the

.Net Encryption

大憨熊 提交于 2019-11-28 04:24:33
What I would like to know is the definite approach to encrypting connection strings in a config file. Here are my questions: Using machine-level encryption, can't anybody accessing my server write a little .Net program to read the contents of the connection strings? If I am deploying my application to users machines in an enterprise environment, and the application has connection strings in a config file, how can I make sure only my application can decrypt it? The scenario is especially interesting in a ClickOnce deployment scenario. I've read about people storing the config unencrypted at the

Fix: The Global element 'configuration' has already been declared

萝らか妹 提交于 2019-11-28 04:16:12
I used the second solution of How to resolve "Could not find schema information for the element/attribute <xxx>"? I.e. created a XSD with the button to create a scheme. I changed the stylesheet in app.config to app.xsd but now I get the warning: The Global element 'configuration' has already been declared in app.xsd Even when changing the name the warning is shown. Does anybody have a solution for this? I had a similar problem to the question you are referring to, I followed these instructions and everything was fine. Make sure the EnterpriseLibrary.Configuration.xsd is in %Program Files%

Fetching connection string from appconfig file in c#

匆匆过客 提交于 2019-11-28 03:45:25
问题 I have the following connection string declared in my app.config file: <connectionStrings> <add name="SqlConnectionString" connectionString="Data Source=xxx.xx.xx.xx;Initial Catalog=xxxxx;User Id=xx;Password=xxx;" providerName="System.Data.SqlClient" /> </connectionStrings> When I try to fetch this connection string using the following C# code snippet, I get the value null . I am not able to obtain the connection string. Is there anything wrong in the syntax? First attempt: var settings =

Is switching app.config at runtime possible?

Deadly 提交于 2019-11-28 03:25:34
问题 Is there a way at runtime to switch out an applications app.config (current.config to new.config, file for file). I have a backup/restore process which needs to replace its own application.exe.config file. I have seen this post but it does not answer how to do this at runtime. 回答1: Turns out I can swap the .config file for the new one and do a ConfigurationManager.RefreshSection(...) for each section. It will update from the new .config file. 回答2: Microsoft .NET's app.config is not designed

App.config: User vs Application Scope

你说的曾经没有我的故事 提交于 2019-11-28 03:17:49
I have added App.config file in my project. I have created two settings from Project > Properties > Settings panel - I have noticed that when I am adding a setting, I can define scope as User or Application . - User Application If I define setting as User it goes to userSettings section, if I define setting as Application it goes to applicationSettings section App.config <configuration> <userSettings> <DemoApp.Properties.Settings> <setting name="MySetting1" serializeAs="String"> <value>Value1</value> </setting> </DemoApp.Properties.Settings> </userSettings> <applicationSettings> <DemoApp