VB.NET Publish Application

62 Views Asked by At

This could be a stupid question for most of you who are experts in programming, but I'm not a professional and I've been moving my first steps so it's not so obvious to me. I developed a VB.NET application using Visual Studio Enterprise 2022, and now I want to share it with my colleagues.

Is it sufficient just to share what is within the bin - Debug Folder? I ask it because I have the following issue.

The company I work for provided me a VDI to develop my solutions, and nothing in there crash both in debug environment and clicking the exe in the debug folder I mentioned above.

When I put the whole Debug folder in a shared folder unfortunetely I have a lot of exceptions (some with alert, some not - the application just freezes and the event viewer say it sometimes kernelbase32.dll, sometimes other components)

In particular I see the following situation: I have a Main Window, which is my dashboard with all the side buttons to decide which form to open.

I open my forms as controls with the following sub

Sub openChildForm(childForm As Form, btnSender As Object)
    SyncLock lock
        If pnlDesktop.InvokeRequired Then
            pnlDesktop.Invoke(Sub() pnlDesktop.Controls.Clear())
        Else
            pnlDesktop.Controls.Clear()
        End If
        With childForm
            .BringToFront()
            .FormBorderStyle = FormBorderStyle.None
            .Dock = DockStyle.Fill
            .TopLevel = False
            If pnlDesktop.InvokeRequired Then
                pnlDesktop.Invoke(Sub() pnlDesktop.Controls.Add(childForm))
                pnlDesktop.Invoke(Sub() pnlDesktop.Controls.Add(childForm))
                .Invoke(Sub() .Show())
            Else
                pnlDesktop.Controls.Add(childForm)
                .Show()
            End If
            frmCurrentChild = childForm
        End With
    End SyncLock
End Sub

and I load the Data in a dedicated Public Module as below:

Public DataModel As New DataTable
Sub LoadData
    Dim dt As New DataTable
    Try
        Using cn = New SqlClient.SqlConnection
            cn.ConnectionString = "Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=ADDRESS\Database.mdf;Integrated Security=True;"
            cn.Open()
            Using cmd = cn.CreateCommand
                cmd.CommandText = "..."
                Using adap As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(cmd)
                    adap.Fill(dt)
                End Using
            End Using
        End Using
        DataModel = dt
        _DataModelLaunched = True
        _DataModelLoaded = True
    Catch ex As Exception
        _DataModelLoaded = False
        Console.WriteLine("Data Model load failed: {0}", ex.Message)
    End Try
End Sub

As I said in the VDI no problem from Visual Studio Debug and from clicking the .exe File, but in the other machines the Datatable contained in the Public Module (which is thought to serve multiple forms) has no Rows.

The first thought is that maybe there is another 'proper' way to share my application, but being a newbie there could be something else. I ask you for a suggestion!

Important: My Company has really strict security rules, so I cannot install nothing both in my VDI and my local machine that need to write on the register, so any setup file or external tools must have this characteristics (the exception are the programs made available on the Software Center)

0

There are 0 best solutions below