RSCG- AppVersion–part 2

 

 

name ThisAssembly
nuget https://www.nuget.org/packages/ThisAssembly
link https://www.clarius.org/ThisAssembly/
author Daniel Cazzulino

The ThisAssembly.Info allows you access to the Assembly Information as constants,instead of going to reflection each time. I found useful to see the assembly version right away in any project that I have.

 

The code that you start with is in .csproj

<PropertyGroup>
<Version>2021.2.15.800</Version>
</PropertyGroup>

The code that you will use is

var strVersion = ThisAssembly.Info.Version;
Console.WriteLine(strVersion);

 

The code that is generated is

/// &lt;summary&gt;
/// Provides access to the current assembly information as pure constants,
///  without requiring reflection.
/// &lt;/summary&gt;
partial class ThisAssembly
{
    /// &lt;summary&gt;
    /// Gets the AssemblyInfo attributes.
    /// &lt;/summary&gt;
    [GeneratedCode(&quot;ThisAssembly.AssemblyInfo&quot;,&quot;1.0.0&quot;)]
    [CompilerGenerated]
    public static partial class Info
    {
        public const string Company = @&quot;RSCG_Version&quot;;

        public const string Configuration = @&quot;Debug&quot;;

        public const string FileVersion = @&quot;2021.2.15.800&quot;;

        public const string InformationalVersion = @&quot;2021.2.15.800&quot;;

        public const string Product = @&quot;RSCG_Version&quot;;

        public const string Title = @&quot;RSCG_Version&quot;;

        public const string Version = @&quot;2021.2.15.800&quot;;

    }
}

Example Code: https://github.com/ignatandrei/RSCG_Examples/tree/main/ApplicationVersion

NrBlog Post
1RSCG–part 1
2RSCG- AppVersion–part 2
3http://msprogrammer.serviciipeweb.ro/2021/02/17/rsgc-enum-part-3/
4RSGC-JSON to Class- part 4
5RSGC-Constructor – Deconstructor – part 5
6RSGC – DTO Mapper – part 6
7RSGC – Skinny Controllers- part 7
8RSGC-Builder Design Pattern – part 8
9RSGC- MetadataFromObject – part 9
10RSGC- Dynamic Mock – part 10
11RSCG- Method Decorator – part 11
12RSCG – Curry – Partial function – part 12
13RSCG- part 13 – IFormattable
14RSCG- part 14 – DP_Decorator
15RSCG- part 15 – Expression Generator
16RSCG- part 16 – Many Others
17RSCG- the book
18RSCG–Template Rendering- part 17
19CI Version
20HttpClientGenerator
21Query from database
22AutoRegister
23TinyTypes
24Static2Interface
25AppSettings
26Properties
27

Posted

in

,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *