问题描述
当我构建Windows应用程序时.它无法工作,因为它无法读取我的app.config文件.我在bin目录中查找,它没有appname.exe.config文件.如果我手动复制了app.config并将其重命名为appname.exe.config,则该应用程序将正常工作.但是,当我构建项目时,此文件将不会自动创建.我想念什么?为什么我的项目没有创建它?我已经浏览了整个文件夹结构,没有其他配置文件.
When I build a windows application. It does not work because it cannot read my app.config file. I looked in the bin directory and it does not have the appname.exe.config file. If I manually copy over the app.config and rename it the appname.exe.config the application will work..but when I build the project this file is never created automagically. What am I missing? Why is my project not creating it? I have looked through the whole folder structure and there is no other config files.
推荐答案
我认为这里的每个人都为您提供虚假信息.我认为@bowlturner做对了.根据Microsoft,您确实需要将app.config
的Copy to output directory
属性设置为Copy Always
或Copy if newer
.从 Microsoft的MSDN站点:
Everyone here is giving you false information I think. I think @bowlturner had it right. According to Microsoft, you do need to set the app.config
's Copy to output directory
property to either Copy Always
or Copy if newer
. From Microsoft's MSDN Site:
Visual Studio自动将源配置文件复制到放置已编译程序集的目录中,以创建输出配置文件,该文件随应用程序一起部署.
Visual Studio automatically copies the source configuration file to the directory where the compiled assembly is placed to create the output configuration file, which is deployed with the app.
这篇关于在Windows应用程序上未创建appname.exe.config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!