1

所以我有一个应用程序,在调试模式和发布模式下,在我自己的个人计算机上运行良好。问题是,在我将它发布到oneClick应用程序后,它不能再找到指定的文件。发布后找不到文件位置

这里是我的代码:

Public Class Form1 

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click 
    Dim usr As String = TextBox1.Text 
    Dim pass As String = TextBox2.Text 
    WebBrowser1.Navigate("www.website.com/api.php?action=authenticate&username=" & usr & "&password=" & pass) 

    Dim Delay = 5000 
    System.Threading.Thread.Sleep(Delay) 

    Dim PageSource = WebBrowser1.DocumentText 
    If TextBox1.Text = "" And TextBox2.Text = "" Then 
     MsgBox("You have to input a valid SG Username and Password", MsgBoxStyle.Critical) 
    ElseIf TextBox1.Text = "" Then 
     MsgBox("You have to input a valid SG Username", MsgBoxStyle.Critical) 
    ElseIf TextBox2.Text = "" Then 
     MsgBox("You have to input your SG Password", MsgBoxStyle.Critical) 
    Else 
     Dim Good = "hash" 
     Dim Check = InStr(PageSource, Good) 
     If Check > 0 Then 
      **System.Diagnostics.Process.Start("Run.bat")** 
     Else 
      MsgBox("Incorrect Username/Password", MsgBoxStyle.Critical) 
      TextBox2.Text = "" 
      Delay = Delay + 2000 
      TextBox2.Select() 
     End If 
    End If 
End Sub 
End Class 

我在/ bin/release文件夹三个额外的文件。要运行的文件,应用程序和Run.bat来执行。该应用程序是在有效登录时执行该文件的表单。 我的问题是为什么它找不到发布之前运行的文件,但不是之后? 有没有一种方法来编码包括在内?

回答

0

将文件添加到您的项目(如果它们尚未添加)。添加完成后,将每个文件的构建操作设置为“内容”。完成之后,在发布选项卡中查找应用程序文件,并确保发布状态设置为包含每个文件。

+0

它的工作!谢谢。我一直在看这个永远 – Matt 2013-04-26 17:55:54

+0

不客气。 – dugas 2013-04-26 17:57:57

+0

当我现在发布时,这三个文件仍被写入本地安装目录。有没有一种方法可以包含内容,但是在安装时没有在下载计算机上显示出来? – Matt 2013-04-26 19:24:14