configurationmanager

What must I do to fix the “mismatch between processor architecture” of my projects?

本小妞迷上赌 提交于 2020-12-15 04:56:36
问题 I have built a Winforms .NET Core app that I want to submit to the Windows Store. In line with that goal, I was able to create an app package from the answer here. Now I want to get my app onto the App Store. Following the steps here, it tells me that if I "created the package by using Visual Studio" I should, "Set the packaging project as the startup project, and then press F5 to start your app." So I did that, but got this err msg: Error MSB3270 There was a mismatch between the processor

How to persist app.config through ClickOnce updates using ConfigurationManager?

◇◆丶佛笑我妖孽 提交于 2020-07-05 08:18:30
问题 This question describes my problem exactly, except I'm using a custom configuration section in app.config with ConfigurationManager , so the solution presented there doesn't apply... Basically, my problem is that when ClickOnce updates the application, it installs into a different directory with the new app.config, thereby erasing any changes made. My application uses app.config to persist application settings, so this is very bad... a merged update would be excellent (similar to what is

How do I select a .Net application configuration file from a command line parameter?

拈花ヽ惹草 提交于 2020-02-13 04:33:28
问题 I would like to override the use of the standard app.config by passing a command line parameter. How do I change the default application configuration file so that when I access ConfigurationManager.AppSettings I am accessing the config file specified on the command line? Edit: It turns out that the correct way to load a config file that is different than the name of the EXE plus .config is to use OpenMappedExeConfiguration. E.g. ExeConfigurationFileMap configFile = new

Reading and writing values in.NET .config files

两盒软妹~` 提交于 2020-01-23 13:11:09
问题 I want to use a custom path for a user.config file, rather than have .NET read it from the default location. I am opening the file like this: ExeConfigurationFileMap configMap = new ExeConfigurationFileMap(); configMap.ExeConfigFilename = String.Format("{0}\\user.config",AppDataPath); Configuration config = ConfigurationManager.OpenMappedExeConfiguration(configMap, ConfigurationUserLevel.PerUserRoamingAndLocal); But I can't figure out how to actually read settings out of it, I get a compile

Using a LINQ Where query to get only some of the ConfigurationManager.ConnectionStrings

拟墨画扇 提交于 2020-01-13 08:58:12
问题 My goal is to use a LINQ Where query on the ConfigurationManager.ConnectionStrings collection in a console application (assume a fresh .NET 4.5 console application with a System.Configuration reference added, and a correspodning using statement). I started with this, which does not work : var relevantSettings = ConfigurationManager.ConnectionStrings.Where(s => s.Name.StartsWith("Xyz")); It tells me that: The type arguments for method ' IEnumerable<TSource> System.Linq.Enumerable.Where<TSource

How do you instruct NUnit to load an assembly's dll.config file from a specific directory?

做~自己de王妃 提交于 2020-01-10 18:01:07
问题 If an assembly contains an app.config file, ConfigurationManager will load it as long as it is in the same directory as the NUnit project that is executing through NUnit-Gui. To illustrate consider the following folder structure. + TestFolder testProject.nunit + AssemblyAFolder assemblyA.dll assemblyA.dll.config + AssemblyBFolder assemblyB.dll assemblyB.dll.config Both AssemblyA and AssemblyB exercise code that calls into ConfigurationManager . If I run these test assemblies independently in

Reading the web.config file from Global.asax

心不动则不痛 提交于 2020-01-07 04:22:09
问题 I have start up code in my Web API project that attempts to read values from the web.config file which is published inside the bin directory by default. Because the application initialization point is Global.asax, there is no web.config at this level so I need to figure out how to reference it down in the bin folder. Here is the root of my IIS directory: Anytime I try to read values from the web.config file using ConfigurationManager.AppSettings they come back null. It's only when I move the

Getting error “The name 'Configuration' does not exist in the current context”

一笑奈何 提交于 2020-01-03 13:05:21
问题 I am using Visual Studio 2013 with .NET Framework 4.5. I have included the System.Configuration as a reference in the project. I have also included a using statement in the class as such: using System.Configuration; However, the following line still gives me the above subject error. How do I get rid of the error? using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["WarrantySqlConnection"].ToString())) The compile time error is on the ConfigurationManager word.

How to parse app.config using ConfigurationManager?

两盒软妹~` 提交于 2020-01-02 09:36:05
问题 I was using a certain method for parsing my app.config file. Then I was told that using ConfigurationManager is better and simpler. But the thing is I don't know how to do it with ConfigurationManager. My original code looked like this: XmlNode xmlProvidersNode; XmlNodeList xmlProvidersList; XmlNodeList xmlTaskFactoriesList; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load("app.config"); xmlProvidersNode = xmlDoc.DocumentElement.SelectSingleNode("TaskProviders"); xmlProvidersList =