Click here to Skip to main content
14,937,037 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This "simple one" has me stuck after three days googling....

How do I get properties such as Company or Authors from the package programmatically?

These should be loaded into header text which is created once when the application starts. As of now I can get Version only.

I've included the working code from my latest prototype. I'm showing placeholders for Company and Authors (where these are now hard-coded). That's what needs replaced.

For this app I am on .NET3.1.

What I have tried:

            public static string HeaderNotes =>
                @"<<COMPANY>>
AUTHOR: <<AUTHORS>>
VERSION:  " + typeof(theNameSpace).Assembly.GetName().Version;
Posted
Updated 24-Mar-21 2:26am
Comments
Richard MacCutchan 24-Mar-21 8:20am
   
Are they valid properties of the Assembly class?

1 solution

The Company is available, but not from the AssemblyName - you need to retrieve it from the assembly attributes: Get assembly information in C# - C# HelperC# Helper[^] should help.
   
Comments
BillWoodruff 24-Mar-21 22:28pm
   
+5
Eek Ten Bears 25-Mar-21 4:56am
   
Thanks Griff, that's an excellent article, clear easy to understand. It doesn't give me Author but we'll do that by hard-coding which on reflection might be more appropriate.
OriginalGriff 25-Mar-21 5:10am
   
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900