【问题标题】:Cannot find File Location after Publishing发布后找不到文件位置
【发布时间】:2013-04-26 17:16:44
【问题描述】:

所以我有一个应用程序可以在我自己的个人计算机上以调试模式和发布模式运行。问题是我将它发布到 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。该应用程序是一种在有效登录时执行文件的表单。 我的问题是为什么它在发布之前找不到要运行的文件,但之后却找不到? 有没有办法在某种包含中进行编码?

【问题讨论】:

    标签: visual-studio-2010 visual-studio one-click-web-publishing


    【解决方案1】:

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

    【讨论】:

    • 当我现在发布时,这三个文件仍在被写入本地安装目录。有没有办法包含内容,但在下载者安装时不显示在下载者计算机上?
    • 有几个选项可以将它们嵌入到程序集中 (stackoverflow.com/questions/6554664/…),或者远程引用它们。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-11
    • 1970-01-01
    • 2018-12-04
    • 1970-01-01
    • 2023-03-10
    • 1970-01-01
    相关资源
    最近更新 更多