Search This Blog

Sunday, December 5, 2021

 public Version IncrementVersion()  
     var random = new Random();  
     //for demonstration purposes - this should come as a parameter  
     var version = new Version(random.Next(0, 10), random.Next(0, 10), random.Next(0, 10), random.Next(0, 10));  
     var versionComponents = version.ToString().Split('.');  
     int.TryParse(versionComponents?.LastOrDefault(), out int lastVersionComponent);  
     var incrementedVersion = new Version(version.Major, version.Minor, version.Build, ++lastVersionComponent);  
     Console.WriteLine($"original version: [{version}] incremented version: [{incrementedVersion}]");  
     return incrementedVersion;   

Tuesday, March 9, 2021

Missing WSMan client and missing liblibpsrpclient in establishing remote sessions using powershell from a docker container 


RUN apt-get update \

    && apt-get install --no-install-recommends -y \

    # less is required for help in powershell

        less \

    # requied to setup the locale

        locales \

    # required for SSL

        ca-certificates \

        gss-ntlmssp \

        libicu63 \

        libssl1.1 \

        libc6 \

        libgcc1 \

        libgssapi-krb5-2 \

        liblttng-ust0 \

        libstdc++6 \

        zlib1g \

    # PowerShell remoting over SSH dependencies

        openssh-client \

    && apt-get dist-upgrade -y \

    && apt-get clean \

    && rm -rf /var/lib/apt/lists/* \

    # enable en_US.UTF-8 locale

    && sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen \

    # generate locale

    && locale-gen && update-locale



RUN apt-get -y install wget

RUN wget ""

RUN dpkg -i multiarch-support_2.19-18+deb8u10_amd64.deb

RUN wget ""

RUN dpkg -i libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb     

#install powershell WSMan.Management module (

RUN pwsh -Command "Install-Module -Name PSWSMan -Force"

RUN pwsh -Command "Install-WSMan"

Sunday, January 10, 2021

Symmetric and Asymmetric Encryption Explained

Wednesday, December 2, 2020

Easiest and shortest sample to get a c# ILogger instance working

 I am embarrassed but I could not get a working ILogger instance to log to the console. I expected this to be achievable with 3, 4 lines. Tried several different approaches, following different posts/articles, nothing !

Using Serilog, however, gives the desired results, easily.

            var serilog = new LoggerConfiguration()



               .WriteTo.File("Logs\\tests.txt", rollingInterval: RollingInterval.Day)



            var logger = new LoggerFactory().AddSerilog(serilog).CreateLogger<LinuxStartUpAndUpdaterManager>();

For instance, I use the following method in a base class all my test classes inherit from:

        protected ILogger<K> GetLogger<K>()


            var serilog = new LoggerConfiguration()


                            .WriteTo.File("testLog.txt", rollingInterval: RollingInterval.Day)


            //if you need a Microsoft.Extensions.Logging ILogger out of your serilog

            return LoggerFactory.Create((c) =>