2015-02-18 2 views
5

तो मैं nuget के साथ खेलना शुरू कर रहा हूं और यह web.config install/uninstall.xdt मान है।यदि उसके बच्चे नहीं हैं तो xdt तत्व को साफ़ करना

मेरा प्रश्न होगा, क्या है और xdt: ट्रांसफॉर्म जो खाली तत्वों को साफ़ करेगा। मुझे यहाँ कुछ भी नहीं मिला। https://msdn.microsoft.com/en-us/library/dd465326%28v=vs.110%29.aspx

मेरा उदाहरण यहां है।

मेरे वर्तमान Web.config.install.xdt इस

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> 
    <system.web> 
    <compilation xdt:Transform="InsertIfMissing"> 
     <assemblies xdt:Transform="InsertIfMissing"> 
     <add xdt:Transform="InsertIfMissing" xdt:Locator="Match(assembly)" assembly="MyAssembly, Version=4.5.4.0, Culture=neutral, PublicKeyToken=asdfasdfasdfasdf" /> 
     </assemblies> 
    </compilation> 
    </system.web> 
</configuration> 

तरह लग रहा है और मेरी स्थापना रद्द करें इस

<?xml version="1.0"?> 
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> 
    <system.web> 
    <compilation> 
     <assemblies> 
     <add xdt:Transform="Remove" xdt:Locator="Match(assembly)" assembly="MyAssembly, Version=4.5.4.0, Culture=neutral, PublicKeyToken=asdfasdfasdfasdf" /> 
     </assemblies> 
    </compilation> 
    </system.web> 
</configuration> 

यहाँ से पहले अपने web.config है की तरह लग रहा (सरलीकृत)

<system.web> 
    <authentication mode="None" /> 
    <compilation debug="true" targetFramework="4.5" /> 
    <httpRuntime targetFramework="4.5" /> 
    </system.web> 

install.xtd

के बाद मेरा web.config यहां है
<system.web> 
    <authentication mode="None" /> 
    <compilation debug="true" targetFramework="4.5"> 
     <assemblies> 
     <add assembly="MyAssembly, Version=4.5.4.0, Culture=neutral, PublicKeyToken=asdfasdfasdfasdf" /> 
     </assemblies> 
    </compilation> 
    <httpRuntime targetFramework="4.5" /> 
    </system.web> 

यहाँ की स्थापना रद्द करें

<system.web> 
    <authentication mode="None" /> 
    <compilation debug="true" targetFramework="4.5"> 
     <assemblies> 
     </assemblies> 
    </compilation> 
    <httpRuntime targetFramework="4.5" /> 
    </system.web> 

के बाद मेरे web.config वहाँ वैसे भी है टैग से छुटकारा पाने के है?

उत्तर

5

ऐसा प्रतीत होता है कि आप किसी तत्व पर एकाधिक परिवर्तन निर्दिष्ट कर सकते हैं। इसलिए आप सामग्री को अपने इंस्टॉल से हटा सकते हैं और फिर तत्व को हटाए जाने पर तत्व के बच्चे हैं या नहीं।

<?xml version="1.0"?> 
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> 
    <system.web> 
    <compilation> 
     <assemblies> 
     <add xdt:Transform="Remove" xdt:Locator="Match(assembly)" assembly="MyAssembly, Version=4.5.4.0, Culture=neutral, PublicKeyToken=asdfasdfasdfasdf" /> 
     </assemblies> 
     <assemblies xdt:Locator="Condition(count(*) = 0)" xdt:Transform="Remove"/> 
    </compilation> 
    </system.web> 
</configuration> 
+0

वाह धन्यवाद, मैं जितनी जल्दी हो सके अपने समाधान का परीक्षण करने की कोशिश करूंगा। मुझे अपने कोड पर फिर से ब्रश करना होगा, यह थोड़ी देर हो गया है। – Lareau

+0

धन्यवाद, मैंने आज सुबह कोशिश की और यह एक आकर्षण की तरह काम किया। जानना अच्छी जानकारी है। – Lareau

+0

ग्रेट टिप, धन्यवाद – resp78

संबंधित मुद्दे