XDT Transforms - Transforming the transform

心不动则不痛 提交于 2019-12-14 03:41:42

问题


I am creating a nuget package where part of the result of installing the package is to modify my web.release.config.

I have no problem inserting elements into this file with my web.release.config.install.xdt, but I need to keep the xdt:Transform and xdt:Locator attributes on the elements I am inserting because these transforms will need to be run when the application is built for deployment.

So for instance when installing the nuget package I would like to see:

<add key="serilog:using" value="Serilog.Sinks.Seq" xdt:Transform="InsertIfMissing" xdt:Locator="Match(key)" />

show up in the web.release.config including the xdt:Transform and xdt:Locator attributes.

Is it possible to do this?


回答1:


I don't believe what you are trying to do is supported by either msbuild or SlowCheetah. Most NuGet package owners dont know enough about their customers implementation to set values into environment specific configs. Additionally the transform tools where not written with NuGet in mind as they was built to serve a different need. Sorry for the bad news.

You may be able to use an init.ps1 powershell script to get this done (NuGet will run this script the first time the package is installed in the solution) but it will be less than clean.



来源:https://stackoverflow.com/questions/30945716/xdt-transforms-transforming-the-transform

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!