本文介绍了更改文件名< AssemblyName.exe.config>到< App.Config>用于Visual Studio中的输出目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这个项目中有一个C#项目和一个App.Config文件.当我生成源代码时,将在输出目录中为应用程序配置创建一个文件(AssemblyName.exe.config),但我需要此文件App.Config的名称.我该怎么办?

I have a C# project and an App.Config file in this project. When i build the source code, a file (AssemblyName.exe.config) is created in the output directory for the application configuration but i want the name of this file App.Config. How can i do that?

推荐答案

您可以使用构建后事件来重命名文件.

You can use a post-build event to rename the file.

但是,请意识到使用该文件的应用程序设置架构将期望名称为AssemblyName.exe.config.如果重命名该文件,则正常的应用程序设置架构将中断.

However, realize that the application settings architecture which uses the file will expect the name to be AssemblyName.exe.config. If you rename the file, the normal application settings architecture will break.

这篇关于更改文件名< AssemblyName.exe.config>到< App.Config>用于Visual Studio中的输出目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 14:25