如果我在 C# 应用程序中删除 App.config 会发生什么? [英] What happen if I delete App.config in C# application?

查看:28
本文介绍了如果我在 C# 应用程序中删除 App.config 会发生什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个小应用程序,我不需要在配置文件中存储任何东西.所以我的源代码中的文件 App.config 正是 Visual Studio 创建的.
所以我想从源代码中删除这个文件(在编译之前).但我注意到它也包含 .NET 版本信息.不知道是不是删除了App.config文件,然后把我的应用程序复制到其他电脑上,有什么奇怪的行为吗?

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.
So I want to delete this file from source code (before compiling). But I noticed that it also contains the .NET version information. I wonder if I delete App.config file, then copy my application to other pc, is it have any strange behavior?

推荐答案

不知道是不是删除了App.config文件,然后把我的应用程序复制到其他电脑上,有什么奇怪的行为吗?

I wonder if I delete App.config file, then copy my application to other pc, is it have any strange behavior?

不,应该没问题.关于在什么情况下使用什么版本的 CLR 等,有各种(有点曲折)规则,但在大多数情况下,您可以只依赖默认行为.

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.

除非您需要提供特定设置,否则您真的不需要 app.config 文件.

You really don't need an app.config file unless you need to give specific settings.

这篇关于如果我在 C# 应用程序中删除 App.config 会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆