Click here to Skip to main content
15,923,006 members
Home / Discussions / C#
   

C#

 
GeneralRe: VS2010 chart Control [modified] Pin
kibromg7-Oct-10 6:21
kibromg7-Oct-10 6:21 
GeneralRe: VS2010 chart Control Pin
Rutvik Dave7-Oct-10 8:01
professionalRutvik Dave7-Oct-10 8:01 
GeneralRe: VS2010 chart Control Pin
kibromg12-Oct-10 6:32
kibromg12-Oct-10 6:32 
GeneralRe: VS2010 chart Control Pin
Rutvik Dave13-Oct-10 9:08
professionalRutvik Dave13-Oct-10 9:08 
Questioncalling vs2005 tool from out side Pin
prasadbuddhika5-Oct-10 23:26
prasadbuddhika5-Oct-10 23:26 
AnswerAttempt to bump post - please don't reply on this thread, reply to the original thread instead. Pin
Pete O'Hanlon5-Oct-10 23:45
mvePete O'Hanlon5-Oct-10 23:45 
QuestionExcel upload Pin
Ramkithepower5-Oct-10 22:39
Ramkithepower5-Oct-10 22:39 
Question.net 2.0 Custom Configuration Sections Pin
AndieDu5-Oct-10 20:51
AndieDu5-Oct-10 20:51 
Dear All,

I am trying to create a class to handle my custom config sections in my app.config file, but no matter what i tried, i always get this kind of error:
Unrecognized attribute 'name'. Note that attribute names are case-sensitive. (D:\Users\xxx\Documents\Visual Studio 2005\Projects\ConsoleApplication2\ConsoleApplication2\bin\Debug\ConsoleApplication2.vshost.exe.config line 10)

I had spent about half days to try to fix this annoy error but without any luck. can someone in here shed me a light will be greatly appreciated.

This is my app.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="packageVersionSection"&gt;
<section name="packageVersion" type="ConsoleApplication2.Class1, ConsoleApplication2" />
</sectionGroup>
</configSections>
<packageVersionSection>
<packageVersion>
<package name="Web Application" version="1.1.2.1" location="C:\Program Files\TeleMedCare\TMSWebApps" />
<package name="RPU Applications" version="1.1.2.1" location="C:\Program Files\TeleMedCare\TMSWinApps" />
<package name="Shared Applications" version="1.1.2.0" location="C:\Program Files\TeleMedCare\SharedApp" />
</packageVersion>
</packageVersionSection>
</configuration>

and this is my source code:

using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;

namespace ConsoleApplication2
{
public class Class1: ConfigurationSection
{
[ConfigurationProperty("package")]
public PackageVersionCollection PackageVersionItems
{
get
{
return ((PackageVersionCollection)(base["package"]));
}
}
}

[ConfigurationCollection(typeof(PackageVersionElement))]
public class PackageVersionCollection : ConfigurationElementCollection
{
protected override ConfigurationElement CreateNewElement()
{
return new PackageVersionElement();
}

protected override object GetElementKey(ConfigurationElement element)
{
return ((PackageVersionElement)(element)).Name;
}

public PackageVersionElement this[int idx]
{
get
{
return (PackageVersionElement)BaseGet(idx);
}
}
}

public class PackageVersionElement : ConfigurationElement
{
[ConfigurationProperty("name", DefaultValue = "", IsKey = true, IsRequired = true)]
public string Name
{
get
{
return ((string)(base["name"]));
}
set
{
base["name"] = value;
}
}

[ConfigurationProperty("version", DefaultValue = "", IsKey = false, IsRequired = true)]
public string Version
{
get
{
return ((string)(base["version"]));
}
set
{
base["version"] = value;
}
}

[ConfigurationProperty("location", DefaultValue = "", IsKey = false, IsRequired = true)]
public string Location
{
get
{
return ((string)(base["location"]));
}
set
{
base["location"] = value;
}
}

}
}
AnswerRe: .net 2.0 Custom Configuration Sections Pin
Keith Barrow6-Oct-10 10:24
professionalKeith Barrow6-Oct-10 10:24 
GeneralRe: .net 2.0 Custom Configuration Sections Pin
AndieDu6-Oct-10 13:36
AndieDu6-Oct-10 13:36 
GeneralRe: .net 2.0 Custom Configuration Sections Pin
Keith Barrow6-Oct-10 21:11
professionalKeith Barrow6-Oct-10 21:11 
Questionmerging two word file [modified] Pin
annie_bel5-Oct-10 18:44
annie_bel5-Oct-10 18:44 
AnswerRe: merging two word file Pin
rah_sin5-Oct-10 19:22
professionalrah_sin5-Oct-10 19:22 
GeneralRe: merging two word file Pin
Thomas Krojer5-Oct-10 20:56
Thomas Krojer5-Oct-10 20:56 
GeneralRe: merging two word file Pin
Dave Kreskowiak6-Oct-10 2:32
mveDave Kreskowiak6-Oct-10 2:32 
AnswerRe: merging two word file Pin
Blue_Boy5-Oct-10 21:30
Blue_Boy5-Oct-10 21:30 
GeneralRe: merging two word file Pin
Luc Pattyn6-Oct-10 4:50
sitebuilderLuc Pattyn6-Oct-10 4:50 
AnswerRe: merging two word file Pin
Pete O'Hanlon5-Oct-10 23:09
mvePete O'Hanlon5-Oct-10 23:09 
QuestionDatatable.BeginInit and EndInit Pin
abcurl5-Oct-10 18:17
abcurl5-Oct-10 18:17 
AnswerRe: Datatable.BeginInit and EndInit Pin
rah_sin5-Oct-10 19:40
professionalrah_sin5-Oct-10 19:40 
QuestionUnable to write Arabic text to a text file using C# [modified] Pin
Meneedhelp5-Oct-10 10:59
Meneedhelp5-Oct-10 10:59 
AnswerRe: Unable to write Arabic text to a text file using C# Pin
Luc Pattyn5-Oct-10 11:08
sitebuilderLuc Pattyn5-Oct-10 11:08 
GeneralRe: Unable to write Arabic text to a text file using C# Pin
Meneedhelp5-Oct-10 11:16
Meneedhelp5-Oct-10 11:16 
GeneralRe: Unable to write Arabic text to a text file using C# Pin
Meneedhelp5-Oct-10 11:57
Meneedhelp5-Oct-10 11:57 
GeneralRe: Unable to write Arabic text to a text file using C# Pin
Luc Pattyn5-Oct-10 13:06
sitebuilderLuc Pattyn5-Oct-10 13:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.