XDT转换更改名称空间前缀

时间:2020-09-16 13:59:36

标签: .net xml nuget xdt-transform xdt

我正在生成一个NuGet包来包装一些第三方DLL,作为其中的一部分,我具有web.config.install.xdt文件,可以将一些预期的部分插入/更新到web.config中。

问题是,当运行转换时,它会重命名xsi前缀,第三方代码对此有依赖性。

有什么方法可以强制对名称空间进行精确映射?

这是XDT文件,元素已重命名

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <configSections>
        <section name="ThirdPartySection" type="ThirdPartySection.Configuration.Section, ThirdPartySection.API, Culture=neutral, PublicKeyToken=abc123" allowLocation="true" allowDefinition="Everywhere" xdt:Transform="Insert"/>
    </configSections>
    <ThirdPartySection xsi:schemaLocation="uri/file.xsd file.xsd" xmlns="uri/file.xsd" xdt:Transform="Insert">
        <Localisation defaultLanguage="en-gb" />
        <Subsections />
        <SomeElement />
    </ThirdPartySection>
</configuration>

我已经将名称空间声明移到了根元素和ThirdPartySection元素上,但是都没有用。任何建议表示赞赏。

0 个答案:

没有答案