Kni*_*Fox 2 c# asp.net app-config nuget xdt-transform
我最近更新了我的一个nuget软件包,现在它需要在消费项目中出现应用程序设置.我想将一个app.config转换添加到包中,任何使用我的软件包的新版本的人都会在这个应用程序设置中填充一些默认值.为此,我按照这篇文章创建了app.config.install.xdt文件.
<?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>
Run Code Online (Sandbox Code Playgroud)
我还根据这个stackoverflow帖子添加了一行我的nuspec
<file src="\Content\app.config.install.xdt" target="app.config" />
Run Code Online (Sandbox Code Playgroud)
但是,当我在消费者中安装/更新此软件包时,我看不到此应用程序设置显示在消费者的app.config中.我还缺少其他任何步骤吗?
nuspec文件条目看起来不正确.它应该是这样的:
<file src="Content\app.config.install.xdt" target="content" />
Run Code Online (Sandbox Code Playgroud)
你的目标是app.config,这是不正确的..xdt转换需要位于NuGet包内的内容目录中.
| 归档时间: |
|
| 查看次数: |
3973 次 |
| 最近记录: |