80295

C#: Config file error

Question:

I created a .config file in which I had not given any <configuration> tag. It works fine in my project. But now when I created the unit test case for the project, it is giving an exception that project.dll doesn't have <configuration> tag. If I include the tag in the .config file the project is giving an error. I am using vs-2008. I created the .config file as:

<?xml version="1.0" encoding="utf-8" ?> <appSettings> .... ..... </appSettings>

If I use <configuration> tag in .config file the error comes in the project and testcase works fine. the error comes as:

<blockquote>

The root element must match the name of the section referencing the file, 'appSettings'

</blockquote>

As I remove the <configuration> tag, the error comes in unit testcase as:

unit test runner failed to load test assembly. jetbrains.resharper.taskrunnerframework.taskexception.configuration system fail to initialize. jetbrains.resharper.taskrunnerframework.taskexception.configuration file project.dll doesnot have <configuration> tag.

Answer1:

You need to wrap the <appSettings> in a <configuration> section. e.g.:

<pre class="lang-xml prettyprint-override"><?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> ... </appSettings> </configuration>

Recommend

  • How to configure Cygnus in relation to Orion and Cosmos
  • R sqldf renaming a field in a select statement
  • Available space left on drive - WinAPI - Windows CE
  • Translating C# to PowerShell in InterIMAP
  • Xamarin Android | Layout style
  • SAXReader not re-ecape characters
  • How to get current document uri in XSLT?
  • How can I set a binding to a Combox in a UserControl?
  • Xcode 4 NSLog Macro link in Xcode 3
  • Very simple C++ DLL that can be called from .net
  • Play WS (2.2.1): post/put large request
  • Bad request using file_get_contents for PUT request in PHP
  • ilmerge with a PFX file
  • Display issues when we change from one jquery mobile page to another in firefox
  • Deselecting radio buttons while keeping the View Model in synch
  • javascript inside java/jsp code
  • SSO with signing and signature validation doesn't work
  • Deserializing XML into class C#
  • JSON with duplicate key names losing information when parsed
  • How to make Safari send if-modified-since header?
  • Why is the timeout on a windows udp receive socket always 500ms longer than set by SO_RCVTIMEO?
  • Jquery - Jquery Wysiwyg return html as a string
  • Google cloud sdk not working when python points python3
  • How to pass list parameters for each object using Spring MVC?
  • Is there a mandatory requirement to switch app.yaml?
  • Android Studio and gradle
  • How to include full .NET prerequisite for Wix Burn installer
  • Buffer size for converting unsigned long to string
  • Hits per day in Google Big Query
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • How to get Windows thread pool to call class member function?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Linking SubReports Without LinkChild/LinkMaster
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • JaxB to read class hierarchy
  • costura.fody for a dll that references another dll
  • How can i traverse a binary tree from right to left in java?
  • How to Embed XSL into XML
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize