Removing comments from web.config for assembly

Is it possible to remove commented lines from web.config during assembly? xml transform perfectly removes some elements, but I could not find the syntax to clear comments from the file.

We use the TFS 2010 build server for our builds.

+3
source share
2 answers

This cannot be done with xml conversion.

But you can do this using your own console application or the msbuild task. See Sample Code here Remove XML Comments Using Visual Studio 2010 Web Config Conversion

+6
source

, -. , , . , YourCommentRemover .

-, . , . , , bin, , (ProjectDir)obj\$(Configuration)\Package\PackageTmp\.

( " " ).

</Project>:

<Target Name="BeforePublish" BeforeTargets="MSDeployPublish">
    <Exec Command="$(ProjectDir)bin\YourCommentRemover $(ProjectDir)obj\$(Configuration)\Package\PackageTmp" />
    <Exec Command="del $(ProjectDir)obj\$(Configuration)\Package\PackageTmp\bin\YourCommentRemover.*" />
</Target>

, - .

0

All Articles