locked
Web Deployment Projects: Web.config sections <system.web> RRS feed

  • Question

  • User1326661867 posted
    I like "Web Deployment Projects" a lot - WELL done!

    I encounter the following by trying to replace the system.web config section in Web.config.
    During the build I get

       Web.config (1): error WDP00002: missing section system.web.

    I can replace other parts of the Web.config, like appSettings, connectionStrings and even system.runtime.remoting, but not system.web.

    Any ideas? Thankx!

    Thursday, November 10, 2005 5:29 AM

All replies

  • User-729062814 posted
    I think you have the honors of finding the first bug.  We're using Configuration.Sections[] to acess the replaceable sections and it doesn't appear to work with system.web.

    I'll enter the bug.  Thanks!

    If you're desperate you can always create a custom task to do.  If you want to peruse that let me know.

    Brad.
    Thursday, November 10, 2005 9:02 PM
  • User1206474571 posted
    I have just gone back to keeping two config files: one for dev and one for deployment using an MSBuild Copy task.  See my post here: Visual Studio 2005 Web Deployment Projects AddIn.

    Will this solve your problem?
    Thursday, November 10, 2005 11:53 PM
  • User-1155260916 posted

    Thanks for the feedback. Is there a compelling reason that you are replacing the entire system.web config section in one shot?

    Friday, November 11, 2005 12:39 PM
  • User-729062814 posted

    btw: we found the problem.  system.web is actually a section group.  A subtle difference but only sections support the configSource attribute.  Unfortunately the Beta of Web Deployment Projects does not let you replace a section within a section group.  For example system.web/authentication where system.web is the section group and authentication is the section. 

    <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>

    We’ve fixed this issue so that in the update you’ll be able to replace sections within section groups.  For example:

    <o:p> </o:p>

                system.web/authentication = authentication.config

                system.net/mailSettings = mailSettings.config

    <o:p> </o:p>

    Hope this will help.  Brad.

    Wednesday, November 16, 2005 8:09 PM
  • User1064934840 posted
    Brad, do you know when the update will be released?  I am having the same problem.  I also need to replace the applicationSettings section group and that does not work either. 
    Thursday, November 17, 2005 1:18 PM
  • User-1155260916 posted

    We are starting to figure out a possible schedule, but nothing firm yet.

    Thursday, November 17, 2005 1:53 PM
  • User1064934840 posted
    I think you have the honors of finding the first bug.  We're using Configuration.Sections[] to acess the replaceable sections and it doesn't appear to work with system.web.

    I'll enter the bug.  Thanks!

    If you're desperate you can always create a custom task to do.  If you want to peruse that let me know.

    Brad.


    Could you please explain how I could create a custom task to do this?
    Thursday, December 1, 2005 10:38 AM
  • User-729062814 posted

    I just created a post on how to create a custom msbuild task for auto-incrementing version numbers. How to auto-increment assembly version using a custom MSBuild task

    This will give you a basic idea of how to create and use a custom msbuild task.

    One of things you'll need to do in your task is get a Configuration object for the web.config file.

    Here is a snippit that will do that.

            /// <summary><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>

            ///     Gets the Configuration object for web.config<o:p></o:p>

            /// </summary><o:p></o:p>

            private Configuration GetWebConfiguration()<o:p></o:p>

            {<o:p></o:p>

                WebConfigurationFileMap webMap = new WebConfigurationFileMap();<o:p></o:p>

                VirtualDirectoryMapping vDirMap = new VirtualDirectoryMapping(_webRoot, true);<o:p></o:p>

                webMap.VirtualDirectories.Add("/", vDirMap);<o:p></o:p>

    <o:p> </o:p>

                return WebConfigurationManager.OpenMappedWebConfiguration(webMap, "/");<o:p></o:p>

            }

    Once you have a Configruation object you can do things like this:

    <o:p>

                // Find the section in the configuration<o:p></o:p>

                ConfigurationSection configSection = config.GetSection(“system.web/authentication”);<o:p></o:p>

                configSection.SectionInformation.ConfigSource = filename;

    <o:p> </o:p>

    Where filename contians the new section.

     

    This technique only works for config sections, if you instead want to repalce the entire system.web section group you should consider just replacing the entire file with a Copy command.  Another option would be to try an merge files using the XmlDocument Class. That's more involved but would be pretty cool.

     

    I hope this gives you enough to get started.

    Brad.</o:p>

     

     

     

     

     

     

    Friday, December 2, 2005 3:44 PM
  • User-1395508978 posted

    Hi!

    We are also experiencing the same problem. In our case, we have the issue when trying to replace Web references (references to web services). They are dynamic and VS 2005 adds a custom configuration section to app.config (that can be copied into web.config). The section is inside a section group and can not be replaced in the current version of the Web Deployment Project. Hope you can release an updated version soon, as many projects include web references.

    Thanks!

     

    Thursday, January 19, 2006 9:08 AM
  • User-1656123233 posted
    Can you please tell me where the replacement file is suppose to be located?  I've tried using a connectionStrings=connectionStrings.config and locating the file in the Web deployment's directory and the Web apps root directory, but neither are being found.  Thanks.


    Derek Greer
    dgreer@fedex.com
    Tuesday, February 21, 2006 1:53 PM
  • User2122145464 posted

    Can you please tell me where the replacement file is suppose to be located?  I've tried using a connectionStrings=connectionStrings.config and locating the file in the Web deployment's directory and the Web apps root directory, but neither are being found.  Thanks.


    Derek Greer
    dgreer@fedex.com

    I am having the same problem! Can anyone shed some light on this issue?

    Thanks in advance for any help,

    Les Prigmore

    Tuesday, March 7, 2006 7:08 PM
  • User-707322781 posted

    Hello,

    I just downloaded the latest Beta of Web Deployment projects, and i'm having an issue replacing a system.web setting.

    the setting I wish to replace is our development setting:

    <system.web>

         <identity impersonate="false" userName="UserName" password="Password" />

    <system.web>

    so, I've setup a replacement file containing

    <identity impersonate="true" userName="UserName" password="LivePassword" />

    (I've also tried wrapping that in a <system.web></system.web> block too)

    And using the replacement directive, in the web deployment:

    system.Web/Identity=TestSystemWeb.config

    I'm guessing it's becuase 'Identity' isn't a section group, just a single key.

    The question is, how can I get around this?

    Cheers,

    Dave.

     

    Friday, March 17, 2006 7:37 AM
  • User1432306715 posted
    Hi, I notice that most of these posts were way back in November, any news on the new release with the fix in place?  Would really like to replace the applicationSettings!

    Thanks.
    Friday, March 17, 2006 11:12 AM
  • User-729062814 posted

    The task that ships with Web Deployment Projects for replacing config sections will only work on sections that support the configSource attribute.

    Hope this helps, Brad.

    Tuesday, March 28, 2006 2:19 PM
  • User1075093880 posted

    Dave,

    The sections are case sensitive.  Verify that your system.Web section is not system.web.

    Trent 

    Tuesday, November 14, 2006 2:17 PM
  • User805391953 posted

    Hi, I posted wrongly the last time so I would like to help me in....

    this problem... http://forums.asp.net/1475443/ShowThread.aspx#1475443

    Thanks in advance...

    Friday, November 24, 2006 7:07 AM