web.config section replacement

G

Guest

I replace a lot of web.config sections during compile.
I am having trouble with a custom section is it possible to replace a custom
section?


Error 44 web.config(1): error WDP00002: missing section
ExceptionHandler. 1 1
CriticalSkills_deploy



<sectionGroup name="ExceptionHandler">

<section name="eMail"
type="System.Configuration.SingleTagSectionHandler"
restartOnExternalChanges="true"/>

<section name="ContactInfo"
type="System.Configuration.SingleTagSectionHandler"
restartOnExternalChanges="true"/>

</sectionGroup>



<!-- Error Handler Configuration Settings -->

<ExceptionHandler>

<eMail connectionStringName="cnnMailQueue" emailTo="(e-mail address removed)"/>

<ContactInfo contactText="(e-mail address removed)"/>

</ExceptionHandler>
 
S

Steven Cheng[MSFT]

Hi Chuck,

Regarding on this web deployment project "section replacement" with custom
section handler issue, I've performed some local test and did repro the
same behavior you mentioned. After some further research, I found that the
problem is due to the MSBUILD engine will use configuration API to process
the web.config file(to do the section replacement), that means if you're
using custom section handler, the msbuild app need to be able to locate the
custom section handler's assembly. And for custom section handlers in a
custom private assembly(in application's bin dir), msbuild won't be able to
locate it. Here is a web thread on forum mentioned the same issue:

http://forums.asp.net/t/1062816.aspx

and currently, some possible workaround options are available:

** strongname the custom seciton handler asembly and put it into GAC so
that msbuild engine can locate it

** instead of section replacement(of web deployment project), you can use
"configSource" attribute of web.config (ASP.NET 2.0 specific) to specify a
section's content in a separate file.

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Thanks Steven,
I think I'll search around for an msbuild xml replacement task and see if I
can do it that way.
 
S

Steven Cheng[MSFT]

Thanks for your followup Chuck,

For the current built-in WDP's limitation, I suggest you submit it on our
product feedback site:

http://connect.microsoft.com/feedback/default.aspx?SiteID=210

Also, for custom MSBUILD tasks, I would recommend the following open source
community project which provides many custom tasks:

#community tasks project
http://msbuildtasks.com/default.aspx

In addition, here is a web article introduce creaeting a custom msbuild
task to modify a certain xml configuration file.

#Using Custom Tasks in MSBuild to modify XML Configuration Files on the Fly
http://www.c-sharpcorner.com/UploadFile/mgold/MSBuildForXml07282006005222AM/
MSBuildForXml.aspx?ArticleID=f1f4249b-171b-4cbc-82eb-83da9c1820ad

Hope this also helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top