如果配置文件不在同一目录中,程序将给出错误 [英] Program gives error if the configuration file isn't in the same directory

查看:91
本文介绍了如果配置文件不在同一目录中,程序将给出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VB.Net中创建了一个用作VU表的程序,它在进度条上显示了值(它正在使用My.Settings函数),然后我用一些与DirectX声音连接的代码更新了它。它工作得很好,但是当我尝试在另一个文件夹中复制构建的程序时,它表示配置文件丢失,当我将配置文件与程序复制到同一文件夹中时,它可以正常工作。这意味着我不能把程序交给其他人,除非我也提供配置文件?

我遇到了Frameworks的问题,但我想出来了,我刚刚添加了这个配置文件的代码:

I made a program in VB.Net that acts as a VU meter and it shows the value on a progress bar(it is using My.Settings functions), and then I updated it with some code that is connected with DirectX sound. It works perfectly, but when I try to make a copy of the built program in another folder, it says that the configuration file is missing, when I copy the configuration file in the same folder with the program, it works. This means that I can''t give the program to someone else, unless I give the configuration file as well ?
I had a problem with the Frameworks, but I figured it out, I just added this code to the configuration file:

<startup useLegacyV2RuntimeActivationPolicy="true">
   <supportedRuntime version="v4.0"/>
 </startup>



也许这搞砸了?



在其他程序,配置文件保存在XP中的Application Data文件夹(%appdata%),(C:\Documents和settings \USER \ Application Data)中。


Maybe that messed it up?

On other programs, the configuration file gets saved in the "Application Data" folder (%appdata%), (C:\Documents And settings\USER\Application Data)in XP.

推荐答案

根据MSDN:



应用程序配置文件必须安装在与应用程序应用程序清单相同的位置。



http://msdn.microsoft.com/en-us/library/windows/desktop/aa374182(v = vs.85).aspx [ ^ ]
According to MSDN:

Application configuration files must be installed in the same location as the application''s application manifest.

http://msdn.microsoft.com/en-us/library/windows/desktop/aa374182(v=vs.85).aspx[^]


但是当配置文件夹与程序不在同一文件夹中时,其他程序如何工作?
But how other programs work when the configuration folder isn''t in the same folder with the program ?


这篇关于如果配置文件不在同一目录中,程序将给出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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