c# - How to use custom sections in app.config from a t4 template -
i trying access custom section in app.config file t4 template in vs2010, assembly defines custom section cannot loaded.
i'm using configurationaccessor section (ref http://skysanders.net/subtext/archive/2010/01/23/accessing-app.configweb.config-from-t4-template.aspx).
app.config:
<configsections> <section name="myproviders" type="system.web.security.mysection, myassembly" /> </configsections> <myproviders default="sqlmyprovider"> <providers> <add name="sqlmyprovider" ... connectionstringname="myconnectionstring" /> </providers> </myproviders>
calling line in .tt file:
mysection section = (mysection)config.configuration.getsection("myproviders");
gives error:
running transformation: system.configuration.configurationerrorsexception: error occurred creating configuration section handler myproviders: not load file or assembly 'myassembly' or 1 of dependencies. system cannot find file specified.
the .tt file references assembly , project, doesn't seem loading config section. have tried implementing mysection class tt code block, can't use class in app.config either.
any ideas?
i think <configsections>
need full assembly names (version, culture, publickeytoken)
type="system.web.configuration.systemwebextensionssectiongroup, system.web.extensions, version=3.5.0.0, culture=neutral, publickeytoken=31bf3856ad364e35"
Comments
Post a Comment