Application / Assembly info

EliCat

Member
Joined
Aug 29, 2002
Messages
17
Location
Netherlands
Im starting to go bonkers here so anyone that can help this relative newbie please do so.


Im working on a splash screen for our application and while loading it I want to show:
- company name
- application name
- application version


I know I can use AssemblyInfo.vb for this but I have no idea how.

The application consists of a couple of projects and the AssemblyInfo.vb file is located in project that loads first.
In this project are also my Main.vb and frmSplash.vb

What I had in my frmSplash.vb is:

Code:
Imports System.Reflection

Public Class frmSplash
	Inherits System.Windows.Forms.Form

	Public Sub SetStatus(ByVal sMessage As String)

	Dim test as [Assembly]

	test.LoadWithPartialName("AssemblyInfo")

	End Sub


....... (form stuff)


End Class


After this how do I access any of the items in the standard AssemblyInfo.vb file?



Seeing as I couldnt get this to work Ive also tried a different way .. now at least I can get the application version, but neither the companyname nor the application name since neither is associated with my *.exe file.

My alternative splash coding is as follows:


Code:
Public Class frmSplash
    Inherits System.Windows.Forms.Form

    Public Sub SetStatus(ByVal sMessage As String)

    Dim UtilisInfo As FileVersionInfo = FileVersionInfo.GetVersionInfo(Application.ExecutablePath)

        Me.lblUtilis.Text = "Versie " & UtilisInfo.FileMajorPart & "." & UtilisInfo.FileMinorPart _
                        & "   Build " & UtilisInfo.FileBuildPart

    End Sub


........ (form stuff)

End Class


If I go this road how can I associate the company name & application name with my executable?




P.S. Ive browsed through this forum extensively and read everything I found about loading the assembly etc, but still dont understand one bit how to apply it, so have some patience if I ask silly questions.
 
Code:
Dim a As Reflection.AssemblyName = System.Reflection.Assembly.GetExecutingAssembly().GetName()

You can then use the various methods of a to find out the version of your assembly easily.

As for company name and product name,

Code:
Application.CompanyName
Application.ProductName

Will do the job. You can ignore the AssemblyInfo.vb file, thats just where you specify them for the compiler, not how to retreive them back at runtime.
 
Cant test what you posted since Im at home, but my main concern with that method is:
where do tell my application what its company and productname are?

I already figured out the bit about Application.CompanyName etc ... but when trying to compile things I got one of those NullReference-errors (or whatever the exact text is), so I know that theres no info to be gotten.
(This is why I started looking into using the AssemblyInfo.vb)


Ive searched high and low and while with my limited VB6 experience I can there easily find where to put that info, I havent yet found it in .NET .... all Ive found is where I can specify the ... erm ... if memory serves me the applicationname (using "Property Pages" in the Solution Explorer).
 
No, you specify all that stuff in the AssemblyInfo.vb file. Thats what its there for, you should see all the blank spaces waiting for be filled in if you havent already.
 
Thats just it ... even when I filled in stuff in the AssemblyInfo.vb file I couldnt access it with Application.CompanyName etc.


I have however solved the problem by using something similar to your "Dim a As ..." statement and then by walking through all the objects in my assembly file and when I find the right assembly type I associate the value of the object with my variable.



Thanks for the input.


Oh yeah, now that I think of it ... any idea why the copyright-object from the standard AssemblyInfo.vb file gives as type System.Diagnostics.Debuggable instead of System.Reflection.AssemblyCopyrightAttribute as it should give?

Is that some sort of bug?
 
Back
Top