如何使用文本文件的ClickOnce并能对其进行更新更新什么时候?什么时候、对其、并能、如何使用

2023-09-05 01:32:38 作者:坐拥万里江山尽享百年孤独

我有一个项目,我想使用的ClickOnce ...

I have a project and i want to use clickonce...

在项目目录,它的文本文件,它需要的BT我的应用程序。

in the project directory, it has text files on it needed bt my applications.

通过的ClickOnce我怎样才能实现我的程序与文本文件到我的最终用户?

How can i deliver my program with the text files to my end users via clickonce?

如果我更改文本文件,添加和删除了,并修改了一些,怎么能ClickOnce的帮助我,以取代旧TEXTFILES和主程序在我的程序结束。

What if i change the text files, added, and removed, and modify some, how can clickonce help me to replace the old textfiles and main program in my end program.

一个样本伪code,如果可能的话。

A sample pseudocode, if possible.

TNX

PS:文本文件由我的程序,但源$ C ​​$ C它不是一部分

Ps: the text files are used by my program but its not part of the source code.

推荐答案

1)你可以提供你一个编写思路的文本文件到您的最终用户。您可以嵌入的文件在你的应用程序,并使用ClickOnce实现了。

1) You can deliver with you programe a text file to your end user. You can embed the file in your application and deliver it with ClickOnce.

(从MSDN)的步骤是:

Steps (from MSDN) are :

右键单击您的项目名称,单击 添加,然后单击添加新项。在 在新建项目对话框中,选择文本 从菜单文件,并命名 文件MyTextFile.txt。当文件 在集成开发开放 环境(IDE),添加一些文字, 然后关闭该文件。 什么是文本文件 文本文件怎么创建

Right-click your project name, click Add, and then click Add New Item. In the New Item dialog box, select Text File from the menu, and name the file MyTextFile.txt. When the file opens in the integrated development environment (IDE), add some text, and then close the file.

右键单击任一文本文件, 然后选择属性。

Right-click either the text file, and then select Properties.

在属性对话框中,找到 生成操作属性。通过 默认情况下,这个属性被设置为 内容。

In the Properties dialog box, locate the Build Action property. By default, this property is set to Content.

单击属性和生成操作属性更改为嵌入的资源。

Click the property and change the Build Action property to Embedded Resource.

2)每次你会做一个新的版本,ClickOnce的会发回新的文本资源

2) Everytime you will do a new version, ClickOnce will send back the new Text Resource

3)

StreamReader _textStreamReader = new StreamReader(_assembly.GetManifestResourceStream("MyNameSpace.MyTextFile.txt"));
Console.WriteLine(_textStreamReader.ReadLine());
 
精彩推荐