मैं here वर्णित वेब.कॉन्फिग ट्रांसफॉर्मेशन प्राप्त करने का प्रयास कर रहा हूं। हमने इस परियोजना का इस्तेमाल अन्य परियोजनाओं पर किया है और यह बिना किसी मुद्दे के काम करता है, लेकिन इस नई परियोजना पर नहीं।web.tconfig web.template.xml से बदल नहीं रहा
यहाँ मैं सफलता
- मामले में wpp.targets फ़ाइल का नाम बदलने मैं इस परियोजना का नाम गलत बिना परीक्षण की कोशिश की है है। मैं वर्तमान में जानता हूं कि मैं काम का उपयोग कर रहा हूं क्योंकि यह केवल एकमात्र ऐसा है जो web.tconfig को web.template.xml से पुनर्निर्मित करने का कारण बनता है। केवल उप टेम्पलेट काम नहीं करते हैं।
- xdt साथ की कोशिश की: लोकेटर = "मैच (नाम)"
- की कोशिश की .config विस्तार .xml बनाम, हमारे अन्य परियोजनाओं जहां इस काम करता है उपयोग .xml
- विन्यास प्रबंधक के लिए "टेस्ट" विन्यास का उपयोग करने के लिए निर्धारित है जिस परियोजना पर मैं काम कर रहा हूं।
- web.template.Test.xml xdt गया है: रूपांतरण = अनुभाग मैं
- web.template.xml प्लेसहोल्डर wpp.targets से "CopyWebTemplateConfig" खंड को हटाने
- की कोशिश की है बदलना चाहते हैं के लिए "बदलें" जैसा कि नीचे जुड़े स्टैक प्रश्न पर सुझाव दिया गया है। हमारी अन्य परियोजनाओं में यह है और "प्रॉपर्टी ग्रुप" सेक्शन ने टिप्पणी की और मैंने दोनों संयोजनों की कोशिश की है।
मैंने उपरोक्त लिंक को कई बार पढ़ा है और यह संबंधित स्टैक question है, लेकिन यह नहीं देख सकता कि समस्या क्या है।
नोट प्रकाशन परिवर्तन एक तरह से काम करता है। यह एक web.template.xml फ़ाइल बनाता है जिसमें web.template.Test.xml के मान शामिल हैं, लेकिन wpp.targets निर्देशों के रूप में web.config.xml नहीं बनाते हैं। तो ऐसा लगता है कि बिल्डिंग ट्रांसफॉर्म काम करने के साथ यह एक मुद्दा है।
किसी को भी क्या पता है कि इसका क्या विचार है?
wpp.targets
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Make sure web.config will be there even for package/publish -->
<Target Name="CopyWebTemplateConfig" BeforeTargets="Build">
<Copy SourceFiles="web.template.xml"
DestinationFiles="web.config"/>
</Target>
<PropertyGroup>
<PrepareForRunDependsOn>
$(PrepareForRunDependsOn);
UpdateWebConfigBeforeRun;
</PrepareForRunDependsOn>
</PropertyGroup>
<!-- This target will run right before you run your app in Visual Studio -->
<Target Name="UpdateWebConfigBeforeRun">
<Message Text="Configuration: $(Configuration): Web.template.$(Configuration).xml"/>
<TransformXml Source="web.template.xml"
Transform="web.template.$(Configuration).xml"
Destination="web.config" />
</Target>
<!-- Exclude the config template files from the created package -->
<Target Name="ExcludeCustomConfigTransformFiles" BeforeTargets="ExcludeFilesFromPackage">
<ItemGroup>
<ExcludeFromPackageFiles Include="web.template.xml;web.template.*.xml"/>
</ItemGroup>
<Message Text="ExcludeFromPackageFiles: @(ExcludeFromPackageFiles)" Importance="high"/>
</Target>
</Project>
web.template.xml
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=152368
-->
<configuration>
<configSections>
<sectionGroup name="TestSettings"></sectionGroup>
....
</configSections>
....
<TestSettings>
</TestSettings>
....
</configuration>
web.template.Test.xml
<?xml version="1.0"?>
<!-- For more information on using transformations
see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<TestSettings xdt:Transform="Replace">
...
</TestSettings>
</configuration>
MSBuild उत्पादन
Target "UpdateWebConfigBeforeRun: (TargetId:143)" in file "C:\...\Project.wpp.targets" from project "C:\...\Project.csproj" (target "PrepareForRun" depends on it):
Task "Message" (TaskId:93)
Configuration: Test: Web.template.Test.xml (TaskId:93)
Done executing task "Message". (TaskId:93)
Task "TransformXml" (TaskId:94)
Transforming Source File: Web.template.xml (TaskId:94)
Applying Transform File: Web.template.Test.xml (TaskId:94)
Executing Replace (transform line 5, 18) (TaskId:94)
on /configuration/TestSettings (TaskId:94)
Applying to 'TestSettings' element (source line 121, 4) (TaskId:94)
Replaced 'TestSettings' element (TaskId:94)
Done executing Replace (TaskId:94)
Output File: web.config (TaskId:94)
Transformation succeeded (TaskId:94)
Done executing task "TransformXml". (TaskId:94)
Done building target "UpdateWebConfigBeforeRun" in project "Project.csproj".: (TargetId:143)
क्या आप मुझे एक नमूना परियोजना भेज सकते हैं जो काम नहीं कर रहा है? मेरा ईमेल कहता है [at] {MicrosoftDOTcom}। –