Working with PowerShell Core on Linux

Here are some useful notes I have been updating whenever I have some new findings.

Installation

First thing first, here is the official documentation on installing pwsh or pwsh-preview on Linux OS.

A known issue

This is a known issue that pwsh will hang after executing any external command if $TERM is screen, i.e. you are running pwsh inside a screen. However, according to the GitHub comment, it seems screen is to blame.

Though this does not limit its usage with other system utilities, I’d like to know if readers like you have some handy solution… Comment below! Continue reading “Working with PowerShell Core on Linux”

If resx localization doesn’t work on your .NET Core application…

Let’s say, you are writing .NET Core application in VS 2017. You have added the following resx resource files to your project

  • Resources.resx (Let’s take it as en)
  • Resources.fr.resx
  • Resources.zh-Hans.resx

However, when running on a French OS, sometimes you may still get English text  for Resource via GetString.

You might as well try Rebuilding the project.

Querying Network Status in .NET programming

Work with `My` namespace

We can use My.Computer.Network.IsAvailable in Visual Basic.NET to determine whether the network is connected. The definition of this property is:

        '''**********************************************************************
        ''';IsAvailable
        ''' <summary>
        '''  Indicates whether or not the local machine is connected to an IP network.
        ''' </summary>
        ''' <value>True if connected, otherwise False</value>
        ''' <remarks></remarks>
        Public ReadOnly Property IsAvailable() As Boolean
            Get

                Return NetInfoAlias.NetworkInterface.GetIsNetworkAvailable()

            End Get
        End Property

It leads to the approach in C#. Continue reading “Querying Network Status in .NET programming”

Content is available under CC BY-SA 3.0 unless otherwise noted.