Run Visual Studio Command Tools Within Powershell

Visual Studio command tools (ie, msbuild, mstest, dotnet) can be directly executed from Powershell and open in a new window.

Likewise, the reverse can also occur.  You can run Powershell from within the Visual Studio tools.
  1. Depending on your version of Visual Studio, locate the path to the common tools.  For example, if you decided to set an environment variable for this path, it could be something like:
    1. VS150COMNTOOLS=C:Program Files (x86)Microsoft Visual Studio2017CommunityCommon7Tools
    2. VS140COMNTOOLS=C:Program Files (x86)Microsoft Visual Studio 14.0Common7Tools
    3. VS120COMNTOOLS=C:Program Files (x86)Microsoft Visual Studio 12.0Common7Tools
    4. VS110COMNTOOLS=C:Program Files (x86)Microsoft Visual Studio 11.0Common7Tools
  2. At this point,  you can open the tool by opening Run –> cmd.exe /k “”%VS150COMNTOOLS%VsDevCmd.bat” & powershell”
  3. At this point, a Powershell prompt will open so that you can directly run msbuild, mstest, etc.

Logging MethodBase.GetCurrentMethod().Name Results in “MoveNext”

Using log4net, the following code example has always (that I’ve paid attention to) successfully written the method name to the log:

CODE:
catch (Exception ex)
{
  globalMgr.Logger.Debug($”Exception thrown in  {MethodBase.GetCurrentMethod().Name} {ex.Message}  {ex.StackTrace} “);
  return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);

LOG TEXT:
Starting HttpClient in GetStoreData()

Lately, however, the method base is logged as “MoveNext.”

LOG TEXT:
Starting HttpClient in MoveNext

The reason for this is that I’m placing the GetCurrentMethod call inside an async method.   Therefore, the final method that the code lives is indeed in “MoveNext.” 

If I don’t get back with a solution soon enough, hard-code your method names into the logging but do not tell anyone I told you to do such a thing.

.NET: ASP.NET CORE 2.0

After a long patient wait, it has finally happened – I’m using ASP.NET CORE 2.0 on all my new projects at work and converting some of my old.   I’m very excited!

Why is this an important advancement for us Microsoft developers?   Simply put,  I can now write applications that will run cross-platform.   And I can do it easily.  I’m not so limited to operating systems or mobile vs. Desktop.  I can keep writing in my favorite flavor – C# — but I also get to stretch out my JavaScript muscles.   I can run Visual Studio on my Windows PC, my Mac, or my Linux box In fact, though Visual Studio makes life easier and faster, I don’t really even need it.   

I can download the .NET CORE SDK on either OS and I am ready to go.  I can use the same templates used in Visual Studio but just initialize them via the command prompt.  Code can be built and ran from this same prompt.  I can edit the code via any text editor.   To make it sweeter; however, downloading the free editor – Visual Studio Code – I can also walk through code and debug!    

I know, it’s been around a while, but in the corporate world, I’ve gotten started earlier than allot of folks.  I cannot say what this does to my efforts at continuous delivery – I actually started to think that I might permanently end up in the Java world without choice. 

You can read about ASP.NET CORE here!

Testing: Postman and Swagger As Additions to Your Tests

Often I need to queue up some unit tests on-the-fly. I recently came across the following helpers:

1.  CREATE POSTMAN API TESTS FROM
SWAGGER

In case anyone else did not know, it is now an option to take the swagger document from your WebAPI, import it into Postman and, voila, test cases for controllers created.   

1.      Create swagger.json from API
2.      Open Postman
3.      Navigate to “Import” button

4.      Open swagger.json file (or paste, etc)

2.  RUN POSTMAN TESTS FROM VISUAL STUDIO

Postman Runner for VSCode allows you to run Postman tests from your VSCode. It analyze the workspace folder and locate collection and environment files.
  • Export your Postman collections and environments in a folder (or subfolders) and open it with VSCode.
  • Open the Command Palette
  • Choose Postman: Run > Question Mode ( Ctrl+Q , Cmd+R )


https://marketplace.visualstudio.com/items?itemName=eridem.vscode-postman



Home Networking: Upgrading Ethernet Network

Note to myself:  regardless of what your current internet provider can offer, when upgrading ethernet cables then plan for the future by buying cat-6*

Click here for data.

PS:  Don’t forget to buy shielded twisted pair only.   This will reduce interference from other signals.

Common industry abbreviations for cable construction
Industry acronyms ISO/IEC 11801 name Cable shielding Pair shielding
UTP U/UTP None None
STP, ScTP, PiMF U/FTP None Foil
FTP, STP, ScTP F/UTP Foil None
STP, ScTP S/UTP Braiding None
SFTP, S-FTP, STP SF/UTP Braiding, foil None
FFTP F/FTP Foil Foil
SSTP, SFTP, STP PiMF S/FTP Braiding Foil
SSTP, SFTP SF/FTP Braiding, foil Foil
The code before the slash designates the shielding for the cable itself, while the code after the slash determines the shielding for the individual pairs:
U = unshielded
F = foil shielding
S = braided shielding (outer layer only)
TP = twisted pair
TQ = twisted pair, individual shielding in quads

Yours Truly.