replace web.config sections using MSBuild

G

Guest

how to replace the system.web section using MSBUILD?
I managed to change the appSettings and connectionStrings sections but when
i tried to replace system.web i got an error message reporting missing
system.web section
 
S

Steven Cheng[MSFT]

Hi Toty,

Thank you for posting.

Regarding on the use MSBUILD to replace the system.web section in
web.config, do you mean you're building some custom build script which will
be executed at build or deployment time and will customize the web.config
file? If so, would provide some detailed background and code snippet on
your current scenario so that we can get further understanding?

Regards,

Steven Cheng
Microsoft Online Community Support


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

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

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


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



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
G

Guest

i am using the web deployment project, which adds a wdproj file to my project.
Now the script below replaces the appSettings section in the web.config file
when the project is being built, but for the system.web section i got
(missing system.web section) error.

<ItemGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<WebConfigReplacementFiles
Include="DeployedConfigs\appSettingsDepld.config">
<Section>appSettings</Section>
</WebConfigReplacementFiles>
</ItemGroup>
 
S

Steven Cheng[MSFT]

Hi Toty,

After some further research and test, I think the problem you encountered
is caused by the "system.web" section name you used. Actually, "system.web"
is not a section, it is a sectiongroup. Sectiongroup is a logical concept
which group a series of sections(somewhat like the namespace for grouping
class, types). So we can not replace sectiongroup in the web deployment
project. If you do want to override some certain sections under a certain
sectiongroup, you can reference them through their full sectionname. e.g:

appSettings=appsettings.config;
system.web/profile=profile.config;

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Community Support


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

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

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


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



Get Secure! www.microsoft.com/security
(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,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top