app-config

ConfigurationManager.AppSettings Returns Null In Unit Test Project

混江龙づ霸主 提交于 2019-12-03 11:19:02
问题 I have a C# unit test project with application settings in the app.config file. I am testing a class that exists in a different project. That class depends on both, ConfigurationManager.AppSettings and ConfigurationManager.ConnectionStrings . The project that the class being tested resides in does not have an app.config file. I would have thought that because the class is being instantiated in the context of the unit test project that it would use the unit test project's app.config file.

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

寵の児 提交于 2019-12-03 10:19:30
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 do this in monodroid or monotouch? You should just use a static class with #if declarations. Something

What does “SKU” (attribute) mean in C#?

一曲冷凌霜 提交于 2019-12-03 09:33:44
Today I encountered with the line <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/> in my App.config file which caused errors with framework when the sku attribute was included. Although, I searched a lot I couldnt really find out what SKU means (other than the definitions "stock keeping unit" or "Shelf Keeping Unit" which I dont think are related to this case). In short, what does SKU mean/stand for ? See the msdn documentation about the supportedRuntime element . It has a table with the valid values for SKU and also what each means. ilmatte A good answer to this question is

App config for dynamically loaded assemblies

非 Y 不嫁゛ 提交于 2019-12-03 09:19:32
问题 I'm trying to load modules into my application dynamically, but I want to specify separate app.config files for each one. Say I have following app.config setting for main app: <appSettings> <add key="House" value="Stark"/> <add key="Motto" value="Winter is coming."/> </appSettings> And another for library that I load using Assembly.LoadFrom : <appSettings> <add key="House" value="Lannister"/> <add key="Motto" value="Hear me roar!"/> </appSettings> Both libraries have a class implementing the

How can multiple elements be added to an XML config file with wix?

寵の児 提交于 2019-12-03 07:53:14
I am trying to edit an XML file with Wix. I am using the WixUtilExtension bundled with Wix 3.7. The xml file is a settings file created in Visual Studio 2010 for a C# application. In this file, I am using an element which is used to store multiple string values in an array. This is the content of the unaltered settings file: <configuration> <applicationSettings> <AppName.Properties.Settings> <setting name="StringArray" serializeAs="Xml"> <value> <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> </ArrayOfString> </value> </setting

Multiple applications with different names for the same code base

冷暖自知 提交于 2019-12-03 07:46:20
问题 Reading this article, thought having the same problem - One code base, two applications on Android I have created an application testApp that has items like topics , splash screens , logos , charts , rules , statuses and/or events . Now, I want different applications ( testApp_USA , testApp_Canada , testApp_Australia )from the same code base and put them on Google Play Store so that if user downloads the application, say, testApp_USA , then only the specific items to that region should be

MSTest.exe not finding app.config

给你一囗甜甜゛ 提交于 2019-12-03 05:47:34
问题 I'm currently trying to run MSTest.exe from NCover, but I believe the question could apply generally to running MSTest.exe from the command line. If I have the "/noisolation" argument, then MSTest.exe appears to find and use the app.config as expected. Without it, NCover doesn't capture any coverage information. From my research so far, it seems NCover needs /noisolation. So the question is how to get my *.config files to work when that argument is passed. My NCover settings are: Application

set default proxy programmatically instead of using app.config

[亡魂溺海] 提交于 2019-12-03 05:40:15
Being behind a proxy, my .Net 4.0 C# application only works when there is an app.config with the following content: <system.net> <defaultProxy enabled="true" useDefaultCredentials="true"> <proxy /> <bypasslist /> <module /> </defaultProxy> </system.net> Now since I don't want to have an app.config and since embedding app.config is not recommended, what is the C# code that has the same effect as that xml chunk in the app.config and where do I place it? You can use WebRequest.DefaultWebProxy or GlobalProxySelection.Select System.Net.GlobalProxySelection.Select = new WebProxy(ip,port); OR System

Do binding redirects in app.config for class libraries do anything?

跟風遠走 提交于 2019-12-03 05:28:15
问题 The VS solutions I often work with consist of a single executable project (console app, web app) and many class library projects that are all referenced by the executable. When working with NuGet and installing packages, there's often an app.config file created for each project, usually containing nothing else than a list of binding redirects that consolidate versions of referenced assemblies. Sometimes there's some third-party library-specific content (like Entity Framework config section),

How to write an URI string in App.Config

ε祈祈猫儿з 提交于 2019-12-03 05:23:16
I am making a Windows Service . The Service has to donwload something every night, and therefor I want to place the URI in the App.Config in case I later need to change it. I want to write an URI in my App.Config. What makes it invalid and how should i approach this? <appSettings> <add key="fooUriString" value="https://foo.bar.baz/download/DownloadStream?id=5486cfb8c50c9f9a2c1bc43daf7ddeed&login=null&password=null"/> </appSettings> My errors: - Entity 'login' not defined - Expecting ';' - Entity 'password' not defined - Application Configuration file "App.config" is invalid. An error occurred