简体   繁体   English

如何防止app.config集成到.net库(dll)中

[英]How do I prevent the app.config from being integrated into a .net Library (dll)

When I compile the library, all the settings in Settings.Settings are integrated into the DLL. 当我编译库时,Settings.Settings中的所有设置都集成到DLL中。 how do I prevent this? 我该如何防止这种情况?

View the properties of the Settings.settings file and set the Build Action to Resource, Copy to Output Directory to Do Not Copy. 查看Settings.settings文件的属性,并将Build Action设置为Resource,Copy to Output Directory to Do Not Copy。

This should create you a dll.config file where you can edit the settings outside of building. 这应该创建一个dll.config文件,您可以在其中编辑建筑物外的设置。

Don't have any settings listed in Settings.Settings. 没有在Settings.Settings中列出任何设置。 If you don't want them being shipped out in the dll, then don't have them. 如果您不希望它们在dll中运出,那么就不要使用它们。 If you have them, then you must need them for something, in which case it makes no sense not to include them. 如果你有它们,那么你必须需要它们,在这种情况下,不包含它们是没有意义的。

If you don't want to expose values, make sure you have an app.config with deployment values (empty, 0, or something). 如果您不想公开值,请确保您的app.config具有部署值(空,0或其他内容)。 The values WILL be compiled into the DLL as default values. 值将作为默认值编译到DLL中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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