gpt4 book ai didi

web-config - 为发布转换 Web Config

转载 作者:行者123 更新时间:2023-12-01 11:34:50 26 4
gpt4 key购买 nike

我的 Web 配置中有以下 XML,在 Release模式下,我需要根据其子项的名称属性删除 dependentAssembly 部分:assemblyIdentity。我在这里尝试了答案:xdt transform locator that matches subnode content但没有运气。我的 web.config 是这样的:

    <?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.VisualStudio.QualityTools.Resource" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<codeBase version="10.0.0.0" href="file:///c:/Program%20Files%20(x86)/Microsoft%20Visual%20Studio%2010.0/Common7/IDE/PrivateAssemblies/Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAdapter.DLL" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

我在我的 web.release.config 中尝试了以下操作,以根据子元素选择要删除的第二个 dependentAssembly 元素,但没有成功。

    <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" >
<dependentAssembly>
<!-- Attempt 1 -->
<assemblyIdentity xdt:Transform="RemoveAll"
xdt:Locator="Condition(@name='Microsoft.VisualStudio.QualityTools.Resource')"/>
</dependentAssembly>
</assemblyBinding>
<!-- Attempt 2 -->
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly xdt:Transform="Remove"
xdt:Locator="Condition(assemblyIdentity/@name='Microsoft.VisualStudio.QualityTools.Resource')">
</dependentAssembly>
</assemblyBinding>
</runtime>

最佳答案

这段代码对我有用。

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly xdt:Transform="Replace" xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='System.Web.Mvc')">
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>

全部归功于@Thommy stackoverflow 对此 post 的回答.

关于web-config - 为发布转换 Web Config,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28244749/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com