How do I get the version number from another project in same solution?

  • Thread starter Thread starter Mark B
  • Start date Start date
M

Mark B

VSTO, C#, Outlook 2007.

I have two projects in a solution, MyCompany.MyAddin and MySetupInstaller.
The later is a Deployment Project.

If I right-click MySetupInstaller and choose Properties, I have a version
number entered of 1.0.2.

How can I programmatically access this from the MyCompany.MyAddin project so
I can display it in our Help, About form?

TIA
 
Mark said:
VSTO, C#, Outlook 2007.

I have two projects in a solution, MyCompany.MyAddin and
MySetupInstaller. The later is a Deployment Project.

If I right-click MySetupInstaller and choose Properties, I have a
version number entered of 1.0.2.

How can I programmatically access this from the MyCompany.MyAddin
project so I can display it in our Help, About form?

You can always load the Assembly instance for that project and get the
version information from there.

But it begs the question: why in the world do you want to know the
version number for your setup project in the add-in? Wouldn't it make
more sense to just have the add-in project's version number track the
setup project's version number, and then just get the add-in version
when you need it?

Pete
 
Thanks.

In Control Panel Add/Remove programs, it shows the version number of the
setup project, not the Add-in project. So that needs to match Help, About...
in the Add-in.

If you are able to give me an example of loading the Assembly instance for
the project and getting the version information from there I'd appreciate
it -- I'm new to C#.
 
Mark said:
Thanks.

In Control Panel Add/Remove programs, it shows the version number of the
setup project, not the Add-in project. So that needs to match Help,
About... in the Add-in.

If you are able to give me an example of loading the Assembly instance
for the project and getting the version information from there I'd
appreciate it -- I'm new to C#.

Not enough details in your question to provide a specific code example.
But, assuming the setup project's assembly is actually on the disk
somewhere, you can use any of the Assembly.LoadXXX() methods to get an
Assembly instance from an executable file on the disk. Then just
inspect the appropriate properties in the Assembly instance you want to
know about.

http://msdn.microsoft.com/en-us/library/system.reflection.assembly_methods.aspx

Pete
 
Back
Top