I created a simple NuGet package that includes an Init.ps1 script in the Tools folder. The script starts as follows:
param($installPath, $toolsPath, $package, $project)
$postBuildEvent = $project.Properties.Item("PostBuildEvent").Value
When installing the package in a Visual Studio 2012 project I get an error on $project.Properties.Item, because $project.Properties is null: "You cannot call a method on a null-valued expression". I checked if $project.Properties is null and it is.
Question is, why it is null. I just try to alter the post build event (like described here). Does anyone have clues?
Edit: If the code is inside Install.ps1 it works. It seems that the project properties are not available when first installing a package.