我尝试制作一个web.config.deBUG.install.xdt文件,但遇到了一个问题:我无法通过转换来插入属性,这些属性本身就是xdt转换的属性.就像是:
@H_404_13@<?xml version="1.0" enCoding="utf-8" ?><configuration xmlns:xdt1="http://schemas.microsoft.com/XML-document-transform"> <system.serviceModel > <clIEnt xdt1:transform="Insert"> <endpoint address="http://blah.blah" binding="basichttpBinding" contract="Test.Contract" name="TestWs" xdt:transform="Replace" xdt:Locator="Match(name)"/> </clIEnt> </system.serviceModel></configuration>(我尝试更改xdt的命名空间,但这也无济于事.)
解决方法 虽然这可能不是最好的答案,但当我发现自己处于这种情况时,它确实为我完成了工作:使用“旧”方法进行变换,而不是xdt方式.
https://docs.nuget.org/create/Transforming-Configuration-Files-Using-dotTransform-Files.md
这似乎运行良好,只需确保相应的xmlns属性在.transform文件中.
例如,如果要转换当前如下所示的web.qa.config文件:
@H_404_13@<?xml version="1.0" enCoding="utf-8"?><configuration xmlns:xdt="http://schemas.microsoft.com/XML-document-transform"> <appSettings> <add key="TIEr" value="qa" xdt:transform="SetAttributes" xdt:Locator="Match(key)" /> </appSettings> </configuration>你可以添加一个元素:
@H_404_13@<add key="RedirectUri" value="yourRedirectUriForQA" xdt:transform="Replace" />通过将以下web.qa.config.transform文件添加到Nuget包中:
@H_404_13@<?xml version="1.0"?><configuration xmlns:xdt="http://schemas.microsoft.com/XML-document-transform"> <appSettings> <add key="RedirectUri" value="yourRedirectUriForQA" xdt:transform="Replace" /> </appSettings></configuration>只需确保将其添加到.nuspec文件中,以便在打包时将其拾取.
总结以上是内存溢出为你收集整理的NuGet包转换配置转换文件全部内容,希望文章能够帮你解决NuGet包转换配置转换文件所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)