The problem you’re running into is that applicationSettings is actually a section group not a section. I know it’s a subtle difference but the ReplaceConfigSections task for Web Deployment Projects can only replace root level sections such as appSettings and connectionStrings. See post http://forums.asp.net/1108562/ShowPost.aspx . We have updated the task so that it can now replace sections within a section group such as “system.web/authentication” and “system.net/mailSettings”.
In your case this would allow you to replace “applicationSettings/ClassLibrary1.Properties.Settings”
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="ClassLibrary1.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<ClassLibrary1.Properties.Settings>
<setting name="ClassLibrary1_localhost_Service" serializeAs="String">
<value>http://localhost/WebService/Service.asmx</value>
</setting>
</ClassLibrary1.Properties.Settings>
</applicationSettings>
You should also be aware that Class Library projects are storing the dynamic URL in a very different location than Web References in a Web Site project. If you were to add that very same WebReference directly to the Web Site project you’d get the following added to web.config
<appSettings>
<add key="localhost.Service" value="http://localhost/WebService/Service.asmx"/>
</appSettings>
This is a root level section and can be replaced by the current ReplaceConfigSections task in Web Deployment Projects.
Notice that the app.config from the Class Library project actually defined a section group named applicationSettings and a section named ClassLibrary1.Properties.Settings. When consuming a Class Library with a Web Reference into an ASP.Net web you must copy the configSections along with the applicationSettings into the web.config file. This will allow the config system for ASP.Net to correctly parse the file and for the Web Reference proxy generated for the Class Library project to find the dynamic URL in web.config.
So, even if you could replace the “applicationSettings/ClassLibrary1.Properties.Settings“ in web.config with Web Deployment projects you’d still have to manually copy the declarations into web.config every time you added a new Web Reference to your Class Library or changed the class name.
The ReplaceConfigSections task in Web Deployment Projects is really useful if all you need to do is to change the URL per deployment configuration. It sounds like what you really want to do is to merge the app.config from the Class Library into web.config so that you’re only maintaining app.config. If that is indeed what you’re looking for then you’ll need to author a custom MSBuild task to do the merge. I can provide more details on this if that is what you’re trying to accomplish.
Hope this helps, Brad.