我最近更新了一个我的nuget软件包,以便它现在需要在应用程序设置中显示在消费项目中。我想将一个app.config变换添加到包中,以便任何使用我的包的新版本的人都将使用一些默认值填充此应用程序设置。为此,我遵循this post来创建app.config.install.xdt文件。如何在app.config上应用xdt转换来安装/更新nuget包?
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings xdt:Transform="InsertIfMissing">
<add key="CustomSetting" value="CustomValue" />
</appSettings>
</configuration>
我还添加了一行根据this stackoverflow post
<file src="\Content\app.config.install.xdt" target="app.config" />
但是,我nuspec当我安装/更新此包中的消费者,我没有看到这个应用程序设置在应用程序中显示出来。消费者的配置。是否还有其他步骤我失踪?
您还应该在您的 条目中添加xdt:Transform =“InsertIfMissing”。否则,当你更新你的软件包时,密钥将被重新插入。 –
Calvin