app-config

How can I debug a VB6 project that has a .net interop project which uses an app.config file?

点点圈 提交于 2019-12-18 05:46:12
问题 I have a .net interop project that uses an app.config file. When I am running the VB6 project that is using the interop control in Debug mode, the ConfigurationManager cannot find the app.config file. When I make the VB6 project into an exe and rename the app.config file to (VB6 binary name).exe.config, the ConfigurationManager can find the file. Is there a way to rename the app.config file or change a setting so ConfigurationManager can find the app.config file while VB6 is running in debug

How to not copy app.config file to output directory

穿精又带淫゛_ 提交于 2019-12-18 05:07:14
问题 I have a WPF application I am building. I am using Visual Studio Community 2015. In an effort to create a "true" release build, I am changing up some build settings so it only generates necessary files that will be installed on the user's computer. So no vshost exe, no generated XML files, etc. etc. etc. (I am retaining PDB file generation, however). I have everything exactly how I want it, except for one file. I have an App.config file in each project. I don't mind this getting copied to the

Can I use / access the app.config from .net code, when called via COM

你说的曾经没有我的故事 提交于 2019-12-18 04:52:37
问题 I have an existing set of .net libraries that I wish to call from Excel VBA (that part is working fine). These libraries rely on settings in the app.config. I know I can enter these settings in a excel.exe.config file (placed in the same directory as the excel.exe), but this doesn't really seem like a very manageable solution to me, as I can see causing conflicts if more than one application wants to do this. My question is simple: is there any way of COM exposed dlls referring to their

Reload app.config with nunit

痞子三分冷 提交于 2019-12-18 04:43:05
问题 I have multiple NUnit tests, and I would like each test to use a specific app.config file. Is there a way to reset the configuration to a new config file before each test? 回答1: Try: /* Usage * using(AppConfig.Change("my.config")) { * // do something... * } */ public abstract class AppConfig : IDisposable { public static AppConfig Change(string path) { return new ChangeAppConfig(path); } public abstract void Dispose(); private class ChangeAppConfig : AppConfig { private bool disposedValue =

.net 3.5: To read connectionstring from app.config?

十年热恋 提交于 2019-12-18 04:42:24
问题 How to read connection string info from app.config file using .net api? Platform is .net 3.5 <?xml version="1.0" encoding="utf-8" ?> <configuration> <connectionStrings> <add connectionString="" providerName="" name=""/> </connectionStrings> </configuration> 回答1: Please see Reading Connection Strings in Web.Config and App.Config and Enterprise Library DAAB Settings (on the Wayback Machine as the original got deleted) ConnectionStringSettings connection = ConfigurationManager.ConnectionStrings[

Reading connection string from external config file

我们两清 提交于 2019-12-18 04:40:34
问题 I have created a console application and an app.config file and Connections.config file. The app.config file has a connectionstring property source pointing to the Connections.config When I tried to read the connection string in the application, I get a ConfigurationErrorException This is my main method. static void Main(string[] args) { var settings = ConfigurationManager.ConnectionStrings; if (settings != null) { foreach (ConnectionStringSettings setting in settings) { Console.WriteLine

Load parts of App.Config from another file

会有一股神秘感。 提交于 2019-12-18 02:42:17
问题 I like to split my app.config into a user specific part and an application specific part. Is it possible to store a part of the app.config in another file? I already tried this: <!DOCTYPE cruisecontrol [<!ENTITY email SYSTEM "email.config">] > but this does not load. Is there another possiblity without changing the application itself? 回答1: You can use the configSource attribute to tell the framework to load a particular section from another file. For example, if you had a config file with a

Load parts of App.Config from another file

大兔子大兔子 提交于 2019-12-18 02:42:01
问题 I like to split my app.config into a user specific part and an application specific part. Is it possible to store a part of the app.config in another file? I already tried this: <!DOCTYPE cruisecontrol [<!ENTITY email SYSTEM "email.config">] > but this does not load. Is there another possiblity without changing the application itself? 回答1: You can use the configSource attribute to tell the framework to load a particular section from another file. For example, if you had a config file with a

CloudConfigurationManager.GetSetting returning null

与世无争的帅哥 提交于 2019-12-17 23:39:14
问题 Following instructions here I have: var connectionString = CloudConfigurationManager.GetSetting("StorageConnectionString"); But connectionString is null , here is my app.config: <?xml version="1.0" encoding="utf-8"?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> <connectionStrings> <add name="StorageConnectionString" connectionString="DefaultEndpointsProtocol=https;AccountName=storage;AccountKey=key" /> </connectionStrings> <runtime>

When is an app.config created, when an app.exe.config and what is the difference

喜夏-厌秋 提交于 2019-12-17 22:46:40
问题 We have created a WinForms application and store some configurations via the ConfigurationManager class. In order to store the information I use Configuration pConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); pConfig.AppSettings.Settings.Add("updates", szUpdatesURL); pConfig.Save(ConfigurationSaveMode.Modified); The problem here is that in some occasions the application creates an "appname".config file and in other occasions an "appname".exe.config. Here I must