admin 管理员组文章数量: 1086019
I have a .NET Core library that needs a specific configuration file in order to work, so I have incorporated the file in the nuget package as an asset so that it will work straight away when deployed.
However I would also like to be able to override that configuration file. In Visual Studio I can do this by having a copy of the file in my project folder configured to copy to output, but when it runs under the dotnet
command line I get the following message:
error NETSDK1152: Found multiple publish output files with the same relative path
Reading the documentation suggests that there is no guarantee of which file will "win" when they are copied.
Obviously, that doesn't work for me, but the pattern I'm looking for is entirely consistent: If there is a configuration in the project use that, otherwise use the default from the library.
Is there a simple way to configure this in my project or in my build so that I can have the project version always override the default and avoid the error mentioned above?
I can see an alternative where I pass in a different configuration file name as an environment variable, but it feels a bit scruffy and ends up with two configuration files in the deployment folder, one of which will never be used.
本文标签: cOverridable configuration in a NET Core nuget packageStack Overflow
版权声明:本文标题:c# - Overridable configuration in a .NET Core nuget package - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1744077054a2529543.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论