トップ回答者
ConfigurationSectionを継承できない

質問
-
いつも参考にさせていただいております。
現在ASP.netに関して「基礎からのASP.NET」(SoftBankCreative)で学習しております。
その中のp257に「カスタムセクションを使った構成情報管理」が紹介されています。
テキスト通りコーディングしているのですがコーディング時に「型’ configration sectionが定義されていません’」のメッセージが出力されてしまいます。
ソースは下記です。ソースを格納するプロジェクトはクラスライブラリに作成しました。なお、同じソースをクラスライブラリでなく新しいWebサイトに保存するとエラーは出ません。
何か設定が間違っているのでしょうか?ご教示下さい。
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections
Imports System.Text
Imports System.Configuration
Imports System.XmlPublic Class UrlMapSection
Inherits ConfigurationSection←エラーメッセージ出力箇所
<ConfigurationProperty("entries", isdefaultcollection:=False)> _
Public ReadOnly Property entries() As EntriesCollectionGet
Dim _entriesCollection As EntriesCollection = Me.Item("entries")
Return _entriesCollection
End Get
End Property
End ClassPublic Class EntriesCollection
Inherits ConfigurationElementCollectionProtected Overloads Overrides Function CreateNewElement() As System.Configuration.ConfigurationElement
Return New EntriesConfigElement()
End FunctionProtected Overrides Function GetElementKey(ByVal element As System.Configuration.ConfigurationElement) As Object
Return DirectCast(element, entriesConfigElement).key
End Function
Public Shadows ReadOnly Property Item(ByVal index As Integer) As entriesConfigElement
Get
Return DirectCast(BaseGet(index), EntriesConfigElement)
End Get
End Property
Public Shadows ReadOnly Property Item(ByVal key As Integer) As EntriesConfigElement
Get
Return DirectCast(BaseGet(key), EntriesConfigElement)
End Get
End PropertyEnd Class
Public Class EntriesConfigElement
Inherits ConfigurationElement
<ConfigurationProperty("key")> Public ReadOnly Property key() As String
Get
Return Me("key").ToString()
End Get
End Property
<ConfigurationProperty("url")> Public ReadOnly Property url() As String
Get
Return Me("url").ToString()
End Get
End Property
End Class
わかばマーク2011年9月2日 4:56
回答
-
Visual Studio のバージョンが不明ですが、このあたりでいかがでしょうか。
[参照設定] ページ (プロジェクト デザイナー) (Visual Basic)
http://msdn.microsoft.com/ja-jp/library/t4ttw1f9.aspx- 回答としてマーク TasCal 2011年9月21日 6:43
2011年9月8日 15:21
すべての返信
-
Visual Studio のバージョンが不明ですが、このあたりでいかがでしょうか。
[参照設定] ページ (プロジェクト デザイナー) (Visual Basic)
http://msdn.microsoft.com/ja-jp/library/t4ttw1f9.aspx- 回答としてマーク TasCal 2011年9月21日 6:43
2011年9月8日 15:21