简体   繁体   English

如果我在C#应用程序中删除App.config会发生什么?

[英]What happen if I delete App.config in C# application?

I write a small application, that I don't need store anything in config files. 我写了一个小应用程序,我不需要在配置文件中存储任何东西。 So the file App.config in my source is exactly what ever Visual Studio has created. 所以我的源代码中的文件App.config正是Visual Studio创建的。
So I want to delete this file from source code (before compiling). 所以我想从源代码中删除这个文件(在编译之前)。 But I noticed that it also contains the .NET version information. 但我注意到它还包含.NET版本信息。 I wonder if I delete App.config file, then copy my application to other pc, is it have any strange behavior? 我想知道我是否删除了App.config文件,然后将我的应用程序复制到其他PC,是否有任何奇怪的行为?

I wonder if I delete App.config file, then copy my application to other pc, is it have any strange behavior? 我想知道我是否删除了App.config文件,然后将我的应用程序复制到其他PC,是否有任何奇怪的行为?

Nope, it should be fine. 不,这应该没事。 There are various (somewhat tortuous) rules about exactly what version of the CLR etc gets used in what situations, but for the most part you're fine to just rely on the default behaviour. 关于究竟什么版本的CLR等在什么情况下被使用,有各种(有些曲折的)规则,但在大多数情况下,你只需要依赖默认行为就可以了。

You really don't need an app.config file unless you need to give specific settings. 除非您需要提供特定设置,否则您确实不需要app.config文件。

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

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