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