Readonly

Using nuget.exe in Visual Studio 2017

In earlier versions of Visual Studio before 2017 I used to create nuget packages by adding a new post-build event that deleted the old nupkg file and created a new package by invoking nuget.exe:

nuget pack "$(ProjectPath)"

This suddenly stopped working in Visual Studio 2017 – I got an error 9009 on this line, meaning that nuget.exe was not found by Visual Studio 2017. So I obtained the latest copy of nuget.exe and put it in C:\Windows\System32, executing it on the Windows console to make sure it was in the Path. It worked. But guess what? The error was still there in Visual Studio and the Visual Studio nuget console.

To make a long story short: As Visual Studio 2017 is still 32-bit, you need to place nuget.exe in C:\Windows\System32\SysWOW64 to make it work…

Readonly

Windows PATH revisited

Previously I wrote a post about making sure the Windows PATH environment variable doesn’t exceed a certain length.

I found out it’s possible to use other environment variables to help you shorten the path. For example, you could store the C:\Program Files (x86) prefix in a new environment variable name PA1 and the C:\Program Files prefix in PA2.

You can then write %PA1%\Microsoft\… instead of C:\Program Files (x86)\Microsoft\… in your PATH variable.

NOTE: The new environment variables must be parsed by the system before the PATH variable, which also means they must appear before PATH when sorted alphabetically.

Readonly

Determine 1st of month

Sometimes you need to get a DATE that is the first of the current month in Microsoft Dynamics NAV. This is not as trivial as it may sound, but the following command does it:

CALCDATE('<CM+1D-1M>')

This date formula gets the current month (that’s always the last day of the month in NAV), adds a day (so we are on the first of the next month) and subtracts a month. Here you go.