日期:2014-05-19  浏览次数:20861 次

使用ClickOnce发布程序问题!能否拷贝文件到指定目录?
C/S程序,采用ClickOnce方式部署到应用服务器上

程序发布完后

要求安装时,能否把项目中某一目录下所有文件自动拷贝到c盘指定目录下?
-------------------------

困扰一天了,看哪位仁兄解决下,感谢!


右击winfor工程属性:页面栏目有

发布程序的一些设置,包括版本信息,发布位置...   ...等信息


------解决方案--------------------
可以换一个升级方式。看看这里
http://www.gofi.cn/#date.2007-6-4/
------解决方案--------------------
"把项目中某一目录下所有文件"拷贝到应用程序的bin目录下.
然后,"右击winfor工程属性:页面栏目有"“应用程序文件”对话框,在里面包括进来发布的文件就会发布到客户端。
------解决方案--------------------
贡献一个自动发布脚本,大家可以看看都有哪些步骤。

' ' 部署脚本
' ' 可接受参数 /s ,表示以静默模式运行,不弹出提示对话框
Dim ProjectName,BeginVersion,SourceFolder,UpdateUrl,CertFileName,CertFilePwd,PublishFolder

' ' 如果部署环境有变,请修改以下参数,文件路径以 "\ "结束
' ' ****************************************************************************
' ' 发布的源文件夹名称 , 注意:不是 bin 目录,而是 bin 的上级目录
SourceFolder = "d:\src\ "
' ' 发布位置,通常是 IIS 下的一个目录
PublishFolder = "d:\deploy\publish\ "
' ' 更新Url,即发布目录的http访问路径
UpdateUrl = "http://xx.xx.xx.xx/publish/ "
' ' ****************************************************************************

CertFileName = "xxx.pfx "
CertFilePwd = "xxx "
ProjectName = "xxx "

Dim ShowTip
ShowTip = True

Dim Args
If Wscript.Arguments.Count> 0 Then
Args = Wscript.Arguments(0) & " "
End If
If Args = "/s " Then
ShowTip = False
End If

Set fso = Wscript.CreateObject( "Scripting.FileSystemObject ")

ShowMsg(0)

' ' 从 Version.txt 读取版本号
Dim Version
Set objText = fso.OpenTextFile( "Version.txt ")
Version = objText.ReadAll()
Call objText.Close

' ' 版本累加
Version = Split(Version,vbCrLf)(0)

Dim ver1,ver2,ver3,ver4
ver1 = CInt(Split(Version, ". ")(0))
ver2 = CInt(Split(Version, ". ")(1))
ver3 = CInt(Split(Version, ". ")(2))
ver4 = CInt(Split(Version, ". ")(3))
ver4 = ver4 + 1
If ver4> =100 Then
ver4 = 0
ver3 = ver3 + 1
If ver3 > = 100 Then
ver3 = 0
ver2 = ver2 + 1
If ver2 > = 100 Then
ver2 = 0
ver1 = ver1 + 1
End If
End If
End If
Version = ver1 & ". " & ver2 & ". " & ver3 & ". " & ver4

' ' 保存最新版本号
fso.DeleteFile "Version.txt "
Set txt1 = fso.OpenTextFile( "Version.txt ",8,True)
txt1.Write Version & vbCrLf & " <Br> " & Date & " " & Time
Call txt1.Close

' ' 把当前版本文件覆盖到发布目录上
fso.CopyFile "Version.txt ",PublishFolder & "Version.txt ",True

' ' 建立版本目录
Dim i,DirectoryName
DirectoryName = PublishFolder & ProjectName & "_ " & Replace(Version, ". ", "_ ")
If fso.FolderExists(DirectoryName) Then fso.Delete(DirectoryName)
fso.CreateFolder(DirectoryName)

ShowMsg(1)

' ' 拷贝需要同步的文件到 PublishFiles 下
If SourceFolder <> " " Then
Dim SourBinFolder,DestFolder
DestFolder = DirectoryName

Set objText = fso.OpenTextFile( "DeployFiles.txt ")
Lines = objText.ReadAll()
Call objText.Close