NUnit testing using the new project format
This is a short recipe for how to set up your project for NUnit testing usign the new project format
Microsoft Visual Studio supports two project formats. The new format uses package references and are much simpler than the old one. It will also pick up any C# file in your folder, so you don’t need to add them explicitly.
All you need to do to use NUnit with the new format is as shown in the example csproj below. The target framework can be any of the .net framework ones. For information on using .net core, see a short recipe for that
Python numpy
Check what is installed
pip list
Downloading and installing numpy:
pip install numpy
Downloading and installing matplotlib
pip install matplotlib
Initializing numpy arrays for vectors
Array of 2D vectors, of length 'n'vectorArray = np.zeros((n,2))Array of 3D vectors, of length 'n'
vectorArray = np.zeros((n,3))
How to add a terminal to Visual Studio 2017
Visual Studio 2017 lack a proper internal terminal. The Command Line extension has been a good substitute, but it opens up in a separate window. If you work with multiple Visual Studio at the same time, you loose track of which command window belongs to which Visual Studio.
Visual Studio Code has it’s own Terminal window built-in, so why not Visual Studio itself? Well, now it is there, a pre-pre tool called Whack Whack (because of how you open it).
MSB4011
Issue with MSB4011 warnings
If MSB4011 warnings appears on every project you have, and you get "tons" of them, then you have this issue. In order to get rid of these annoying warnings you must fix up your installation as described below..How the error appears
First of all, you see warnings like shown below in the Output window for build:2>C:\Program Files (x86)\MSBuild\15.0\Microsoft.Common.targets\ImportAfter\Microsoft.NuGet.ImportAfter.targets(16,3): warning MSB4011: "D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets" cannot be imported again. It was already imported at "D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Microsoft.Common.targets\ImportAfter\Microsoft.NuGet.ImportAfter.targets (16,3)". This is most likely a build authoring error. This subsequent import will be ignored. [C:\Users\Terje\Source\Repos\ABC\Engine.csproj] 2>C:\Program Files (x86)\MSBuild\15.0\Imports\Microsoft.Common.props\ImportBefore\Microsoft.NuGet.ImportBefore.props(16,3): warning MSB4011: "D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.props" cannot be imported again. It was already imported at "D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Imports\Microsoft.Common.props\ImportBefore\Microsoft.NuGet.ImportBefore.props (16,3)". This is most likely a build authoring error. This subsequent import will be ignored. [C:\Users\Terje\Source\Repos\ABC\Tool.csproj]Further, you see multiple of the same warnings in the Visual Studio Error window:
How to find/clear your Nuget caches
Nuget maintains a set of caches on your local machine, or your build server.
Sometimes you need to find and clear a particular package, or simple clear the caches.
The most used locations can be found at:
%LocalAppData%\NuGet\Cache
%UserProfile%\.nuget\packages
The easiest way to find all of them however is to use nuget itself:
The following command lists all the cache locations:
nuget locals all -list
You will see four different cache locations.
Installing Azure CLI for bash on Windows
Introduction
This short guide explains how you get the Azure CLI to show up properly with the Bash shell in Windows.
Checking if you have Azure CLI installed
You might have the Azure CLI installed even if it doesn’t show up in your bash shell. Check first using either Cmd or Powershell, by running e.g.
az --version
You can run this from the bash shell, but using the full name of the cmd file:
Beware of the end-of-life for .Net Framework and .Net Core versions
There are multiple versions of .Net Framework, and also of .Net Core. Many of the versions have now reached their end of life point. That means the versions are no longer supported, not with bug fixes and not with security fixes either.
Some version are in the LTS (Long Term Support) mode. This means they will receive critical fixes, and compatible fixes for a period of 3 years. Microsoft also states that every second release will be set up for LTS.