ClickOnce 配置部署 - 配置文件

发布于 2024-08-06 22:15:34 字数 222 浏览 3 评论 0原文

我正在使用 ClickOnce 部署应用程序,问题是配置文件 (xxx.exe.config) 未嵌入到包中,并且没有包含它的选项。配置的另一个问题是,当我尝试手动将其写入部署的目录(Environment.CurrentDirectory)时,我遇到了异常 - 我没有权限这样做。

关于如何部署应用程序和配置文件有什么想法吗? (并使其可写,因为 ti 运行时的应用程序会更改配置值。)

提前致谢

I'm deploying an application using ClickOnce, the problem is that the configuration file (xxx.exe.config) is not embedded in the package and there is no option to include it. Another problem with the config is that When I'm trying to manually write it to the directory where it is delopyed (Environment.CurrentDirectory) I'm getting an exception - I have no permissions to do that.

Any ideas on how to deploy the app along with the configuration file? (and to make it writable, because the applications during ti's runtime alters the config values.)

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

卖梦商人 2024-08-13 22:15:34

您还可以更改要包含在 ClickOnce 部署中的文件的构建操作:文件属性 → 构建操作 → 设置为“内容”,这会将文件添加到 列表中发布 项目选项中的应用程序文件

如果您需要从引用的项目发布文件,我没有找到更好的解决方案,而是添加→现有项目→在“添加”按钮上,选择“添加为链接”,然后设置对 Content 执行操作并检查已发布文件的列表。

You can also change build action for files that you want to include in ClickOnce deploy: Properties for a file → Build Action → set to "Content", this will add the file to the list of Application files in Publish project options.

If you need to publish a file from a referenced project, I didn't find a better solution rather than to Add → Existing Item → On "Add" button, select "Add as Link", then set action to Content and check the list of published files.

你在我安 2024-08-13 22:15:34

配置文件应该自动发布;如果没有,请确保将其配置为复制到输出,并且(如果失败)检查发布文件(项目属性 -> 发布 -> 应用程序文件;配置文件应标记为“包含(自动)”或“包括”)。

您不应尝试更新应用程序安装目录中的任何内容。一般来说,这是一个坏主意(因为除非您是管理员,否则您不能假设您可以更新“程序文件”),但对于 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.

惟欲睡 2024-08-13 22:15:34

当您单击项目的“属性”并转到项目属性的“发布”选项卡时,单击“应用程序文件...”,然后选中“显示所有文件”复选框。您应该会看到一个选项,可以从那里选择您的应用程序配置文件。

根据我的经验,<*>.exe.config 文件通常设置为自动包含。

When you click on the Properties of your project and go to the Publish tab of the project's properties, click Application Files... then check the 'Show All Files' checkbox. You should see an option to choose your applications config file from there.

In my experience the <*>.exe.config file is usually set to include automatically however.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文