简体   繁体   中英

How to use XDT on NuGet install if there is no config file already there?

Admittedly this is a corner case.

However, I have developed some XDT install and uninstall transforms that work very well for my NuGet package installation and uninstallation. All good there.

However, in the case where the consuming project does not itself already have an app.config file (or web.config file) when the package is installed, there are no warnings or complaints, but it doesn't actually create a new-from-scratch config file with the "stuff" in it that I want.

How can you use XDT to create a new config file from scratch if there isn't one already there to transform?

Simple fix seems to be to include an app.config.transform in addition to the app.config.install.xdt. All the work goes in the xdt file, and the app.config.transform has only the basic shell of an app.config file, namely:

<configuration/>

This seems to cause an app.config file to be created if one isn't there, but it doesn't overwrite one that is there, and then the xdt transform gets applied to that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM