Home All Groups Group Topic Archive Search About

Generate a text/binary file during installation

Author
3 Apr 2006 2:10 PM
Windy
Hi all expert,
    (I got no solution on deployment group)

    I would like to know how I can execute my own vb .net function during
installation.
I had created my own setup project, but i don't know how can i make a text
file included the Client's Computer Name.

Thanks alot.

Author
3 Apr 2006 2:22 PM
jvb
To get the current computers name use
System.Windows.Forms.SystemInformation.ComputerName. See if the
function below helps you out.

Private Function WriteComputerName() As Boolean

        Dim strWriter As IO.StreamWriter
        Dim boolReturn As Boolean

        Try
            strWriter = New IO.StreamWriter("<FLAT FILE LOCATION>")
        Catch ex As Exception
            Return False
        End Try

        Try
            strWriter.WriteLine("Computer Name: " &
System.Windows.Forms.SystemInformation.ComputerName)
            boolReturn = True
        Catch ex As Exception
            strWriter.WriteLine("Unable to determine computer name: " &
Err.Description)
            boolReturn = False
        Finally
            strWriter.Close()
        End Try

        Return boolReturn

    End Function
Author
3 Apr 2006 2:44 PM
Windy
Hi  jvb,
    Actually the main problem is where to put this function call to make it
work during installation when using setup project?

"jvb" <gome***@gmail.com>
???????:1144074172.059946.57***@j33g2000cwa.googlegroups.com...
Show quoteHide quote
> To get the current computers name use
> System.Windows.Forms.SystemInformation.ComputerName. See if the
> function below helps you out.
>
> Private Function WriteComputerName() As Boolean
>
>        Dim strWriter As IO.StreamWriter
>        Dim boolReturn As Boolean
>
>        Try
>            strWriter = New IO.StreamWriter("<FLAT FILE LOCATION>")
>        Catch ex As Exception
>            Return False
>        End Try
>
>        Try
>            strWriter.WriteLine("Computer Name: " &
> System.Windows.Forms.SystemInformation.ComputerName)
>            boolReturn = True
>        Catch ex As Exception
>            strWriter.WriteLine("Unable to determine computer name: " &
> Err.Description)
>            boolReturn = False
>        Finally
>            strWriter.Close()
>        End Try
>
>        Return boolReturn
>
>    End Function
>
Author
3 Apr 2006 2:52 PM
jvb
You can place it anywhere in the install routine. I would place it at
the beginning of the project's execution so that you can have the
computer's name if the install fails.