Cannot find File Location after Publishing

280 Views Asked by At

So I have an application that works great on my own personal computer in debug mode and release mode. The issue is that after I publish it to a oneClick Application it can no longer find the specified file.

Here is my code:

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

I have three extra files in the /bin/release folder. a file to run, the application, and Run.bat to execute. The application is a form that executes the file upon valid login. My question is why cant it find the files to run before publishing, but not after? It there a way to code in some sort of include?

1

There are 1 best solutions below

2
On BEST ANSWER

Add the files to your project (if they are not already added). Once added, set the build action for each file to Content. After doing that, in the publish tab, look in the Application Files and make sure the publish status is set to include for each file.