Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Distributing shared assemblies

Status
Not open for further replies.

fawkes

Technical User
Sep 12, 2003
343
GB
I've created a shared assembly, when the assembly is installed it also installs some files in the application settings folder.

I'm going to create a number of other applications that reference this shared assembly and I need to know a few things.

1. When I create a setup for the new applications the shared assembly is automatically added to the ApplicationFolder along with the project output. Will this always be added to the ApplicationFolder even if it already appears in the global assembly cache?

2. Is it possible to create a setup that will check to see if the assembly is already in the global assembly cache and, if not, will run the assembly's set up program instead of just adding the assembly's dll file to the ApplicationFolder?

Any pointers or links would be appreciated.

Cheers
 
Getting there.

I've started an installer class and written the following code:

Code:
Private Sub HelperInstaller_BeforeInstall(ByVal sender As Object, ByVal e As System.Configuration.Install.InstallEventArgs) Handles Me.BeforeInstall

        'Collect the current assembly
        Dim thisAss As System.Reflection.Assembly
        thisAss = System.Reflection.Assembly.GetExecutingAssembly

        'Loop through the referenced assemblies looking for the correct
        'referenced assembly
        For Each nextAss As System.Reflection.AssemblyName In _
                                            thisAss.GetReferencedAssemblies
            If nextAss.Name = "MyReferencedAssembly" Then

                'Attempt to load the assembly
                Dim refAss As System.Reflection.Assembly
                refAss = Nothing
                Try
                    refAss = System.Reflection.Assembly.Load(nextAss)
                Catch fileEx As System.IO.FileNotFoundException
                                        System.Diagnostics.Process.Start(Application.StartupPath & System.IO.Path.DirectorySeparatorChar & "MyRefAss_setup.exe")
                Catch ex As Exception
                    MessageBox.Show(ex.GetType.ToString & Microsoft.VisualBasic.vbCr _
                                        & Microsoft.VisualBasic.vbLf & ex.Message)
                End Try

           End If


        Next


The problem I'm now having is identifying the location of the setup file, I've stored it in the same location as the original setup file (there are two files, one called setup.exe and the other MyRefAss_setup.exe that installs the referenced assembly) but it looks like Application.StartupFolder is the Windows/System32 folder.

Anyone help me with this bit?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top