nuget.exe in Visual Studio 2017 verwenden

In früheren Versionen von Visual Studio konnte ich nuget Packages erzeugen, indem ich ein Post-Build-Ereignis hinzufügt, das das alte Paket löschte und ein neues durch Aufrufen von nuget.exe erzeugte:

nuget pack "$(ProjectPath)"

Das hat mit einem Mal in Visual Studio 2017 nicht mehr funktioniert. Stattdessen begrüßte mich ein Fehler #9009 in der entsprechenden Zeile, was bedeutet, dass nuget.exe von Visual Studio nicht gefunden werden konnte. Ich kopierte die neueste Verson von nuget.exe in C:\Windows\System32 und konnte das Programm auch erfolgreich von der Windows Console aufrufen. Aber was soll ich sagen? Der Fehler in Visual Studio kam immernoch. Auch in der Visual Studio Nuget Console.

Langer Rede kurzer Sinn (und Facepalm): Da Visual Studio ein 32-bit Programm ist, muss nuget.exe natürlich in C:\Windows\System32\SysWOW64 um es zum Laufen zu kriegen…

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.

Always watch your PATH

For a couple of days I’ve had major trouble with my work notebook. After installing new Visual Studios (2012 and 2013), all of a sudden various system software stopped working.

For example several applications could no longer be started using the pinned icons in the task bar. Also, when trying to invoke some system dialogs in the Control Panel I got error messages like %windir%\system32\xyz.exe was not found. Or the strange fact that all the entries in the Start Menu lost their symbols…

After some days of much cursing and swearing, several attempts of restoring previous Restore Points, etc., I got a hint that solved my problem:

The content of the PATH environment variable may not be longer than 2048 characters! If it is, neither the PATH variable, nor any other %..% system variable will work.

I shortened the path, rebooted, problem solved. Welcome to Windows 7, where the PATH variable is still limited in length…