我在我的Web配置和发布模式中有以下XML,我需要根据子项的name属性删除dependentAssembly部分:assemblyIdentity.我在这里尝试了答案:xdt转换定位器匹配子节点内容但没有运气.我的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>
Run Code Online (Sandbox Code Playgroud)
我在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>
Run Code Online (Sandbox Code Playgroud)