I've published a app using Clickonce Deployment for use on our LAN (so I've set it to online only for ease of updates etc)
When I run the setup on my own machine, the app installs and runs with no issue however when I run the setup on my test machine, The program installs and opens but I get an error while running it about an object reference not being set. The application is falling over where a user logs into the system and the app makes a call to a SQL database using SQL native client.
I've looked at the references and System.data is there I've also checked that System.Data and Microsoft.SQLServer name spaces are included.
I next made sure the application was set to a full trust application under the security for ClickOnce deployment. I then set all the application files to Include and made sure the .net framework 3.5SP1 was checked under the prerequiste files and download prerequistes from vendors web site was checked.
But I still didn't get it to work on the test machine I noticed that SQL native Client had not installed on the test machine so I ran the sqlncli.msi off of my SQL 2005 server disk to install it manually but I still can't get it to run.
I know I'm probably missing something but I've never deployed with ClickOnce before so I'm not 100% sure of it.
Here is the code where the system falls:
Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click Dim strResult As String = "" Dim strTitle As String = "" Dim strUserName As String Dim strPwd As String Dim intUserID As Integer = 0 Dim objDB As New DataAccessLayer 'custom class for interacting with database Dim tblLoginResults As Data.DataTable Dim drLoginData As DataRow Dim strPrinter As String Dim intPrinter As Integer = 0 On Error GoTo ErrorHandler strUserName = Trim(txtUser.Text) strPwd = Trim(txtPassword.Text) If strUserName <> "" And strPwd <> "" Then 'pass into function to return datatable tblLoginResults = objDB.LoginUser(strUserName, strPwd) 'runs a Stored Procedure on Database and returns users record. If tblLoginResults.Rows.Count = 0 Then 'no match found LoginSuceed = False strResult = "Invalid Username and Password" strTitle = "Log On Failed" Else drLoginData = tblLoginResults.Rows(0) LoginSuceed = True strTitle = "Log on suceeded" strResult = "Welcome" intUserID = drLoginData("ID") 'UserID = intUserID TeamMemberType = CLng(drLoginData("TeamMemberType")) UserName = drLoginData("FirstName") & " " & drLoginData("LastName") End If objDB.InsertUserAccessLogRecord(strUserName, strPwd, intUserID, "Login to Print Docs", LoginSuceed) Else LoginSuceed = False strResult = "Please enter a Username and Password" strTitle = "Log On Failed" End If MsgBox(strResult, MsgBoxStyle.OkOnly, strTitle) If LoginSuceed Then 'get printer info here and put into array, saves time later on. ReDim PrinterArray(PrinterSettings.InstalledPrinters.Count) For Each strPrinter In PrinterSettings.InstalledPrinters PrinterArray(intPrinter) = strPrinter intPrinter = intPrinter + 1 Next End If Me.Close() Exit Sub ErrorHandler: DisplayError(Err, "Log On") LoginSuceed = False End Sub