Show / Hide Table of Contents

Class AssemblyAttributeHelpers

Provide static methods for obtaining AssemblyAttributes for various uses, such as identifying programs in their user interfaces.

Inheritance
System.Object
AssemblyAttributeHelpers
Namespace: WizardWrx.AssemblyUtils
Assembly: WizardWrx.AssemblyUtils.dll
Syntax
public static class AssemblyAttributeHelpers : object

Methods

| Improve this Doc View Source

GetAssemblyAppDataDirectoryName(Boolean)

Get the absolute (fully qualified) name of the Application Data directory that is set aside for use by assemblies published by the company named in the AssemblyCompany property of the entry assembly.

Declaration
public static string GetAssemblyAppDataDirectoryName(bool pfCreate)
Parameters
Type Name Description
System.Boolean pfCreate

If TRUE, the specified directory is created if necessary.

Returns
Type Description
System.String

The return value is the absolute (fully qualified) name of the Application Data directory that is set aside for use by assemblies published by the company named in the AssemblyCompany property of the entry assembly. If pfCreate is TRUE, the directory named therein is guaranteed to exist. Otherwise, its existence is not guaranteed.

| Improve this Doc View Source

GetAssemblyCompanyNameSnakeCased(Assembly)

Get the AssemblyCompany property, which usually contains spaces, and often commas and other invalid characters, and either remove them or replace them with underscores.

Declaration
public static string GetAssemblyCompanyNameSnakeCased(Assembly pasm = null)
Parameters
Type Name Description
Assembly pasm
Returns
Type Description
System.String

The string returned by this method is the string representation of the value of AttributeFriendlyName.Company as it was recorded in AssemblyInfo.cs of the assembly specified by pasm, with commas, underscores, single quotes, hyphens, and spaces replaced by underscores, and sequential underscores reduced to one.

| Improve this Doc View Source

GetAssemblyGUID(Assembly)

Call this method to get the AssemblyGUID that is embedded in the assembly's metadata (See its AssemblyInfo.cs.).

Declaration
public static System.Runtime.InteropServices.GuidAttribute GetAssemblyGUID(Assembly pasm)
Parameters
Type Name Description
Assembly pasm

Specify a reference to the System.Reflection.Assembly object, which must be loaded "for real" as opposed to ReflectionOnly.

Returns
Type Description
System.Runtime.InteropServices.GuidAttribute

The return value is the System.Runtime.InteropServices.GuidAttribute assembly attribute applied to the assembly via its AssemblyInfo.cs.

| Improve this Doc View Source

GetAssemblyTargetFramework(Assembly)

Get the Target Framework attribute from the pasm assembly.

Declaration
public static System.Runtime.Versioning.TargetFrameworkAttribute GetAssemblyTargetFramework(Assembly pasm)
Parameters
Type Name Description
Assembly pasm

Specify a reference to the System.Reflection.Assembly object, which must be loaded "for real" as opposed to ReflectionOnly.

Returns
Type Description
System.Runtime.Versioning.TargetFrameworkAttribute

The return value is the System.Runtime.Versioning.TargetFrameworkAttribute attribute applied to the assembly by the build engine.

Remarks

Be advised that this routine truly supports only target frameworks 4.0 and above. Versions 2.5, 3.0, and 3.5 are reported as version 2.5, and versions 1.0 and 1.1 will return a null reference.

| Improve this Doc View Source

GetAssemblyVersionInfo(AssemblyAttributeHelpers.AttributeFriendlyName, Assembly)

Get common version attributes from the entry assembly.

Declaration
public static string GetAssemblyVersionInfo(AssemblyAttributeHelpers.AttributeFriendlyName penmAttributeFriendlyName, Assembly pasm = null)
Parameters
Type Name Description
AssemblyAttributeHelpers.AttributeFriendlyName penmAttributeFriendlyName

A member of the AttributeFriendlyName describes the desired version attribute.

Assembly pasm

Pass in a reference to the Assembly for which assembly attributes are wanted, or pass NULL to get the metadata from the entry assembly.

Returns
Type Description
System.String

The string returned by this method is the string representation of the value of the attribute specified by penmAttributeFriendlyName as it was recorded in AssemblyInfo.cs of the assembly specified by pasm.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX