带有confi文件的应用程序在运行文件夹中 [英] Application with confi file in the running folder
问题描述
您好,
我的应用程序中有confi设置
Hello,
I have confi settings in my application
<?xml version="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
<requiredRuntime version="v4.0.20506" />
</startup>
</configuration>
i想要在没有confi文件的情况下部署我的exe。
谢谢
i want to deploy my exe without confi file.
thanks
推荐答案
参考 - ClickOnce配置部署 - 配置文件 [ ^ ]
Refer - ClickOnce configuration deployment - configuration files[^]
配置文件应自动发布;如果没有,请确保将其配置为复制到输出,并且(如果失败)检查发布文件(项目属性 - >发布 - >应用程序文件;配置文件应标记为include(auto)或include)。
您不应尝试更新应用安装目录中的任何内容。这通常是一个坏主意(因为你不能假设你可以更新程序文件,除非你是管理员),但ClickOnce也是如此。
只需使用一些用户设置创建设置文件;这些将保存在用户的配置文件中,因此可以可靠地更新。您无法编辑通过ClickOnce部署的文件;即使您有访问权限,它也会(默认情况下)中断散列函数,并且会拒绝加载它们。你可以关闭散列,但是......这仍然不是一个好主意。
The config file should get published automatically; if not, ensure that it is configured to copy to output, and (if that fails) check the publish files (project properties -> publish -> application files; the config file should be marked as "include (auto)" or "include").
You shouldn't attempt to update anything in the app install directory. That is a bad idea generally (since you can't assume you can update "program files" unless you're an admin), but the same holds true for ClickOnce too.
Just create a settings file with some user settings; these will be saved in the user's profile, so can be updated reliably. You can't edit the files deployed via ClickOnce; even if you had access, it would (by default) break the hashing function, and it will refuse to load them. You can turn off the hashing, but... this still isn't a great idea.
这篇关于带有confi文件的应用程序在运行文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!