mirror of
https://github.com/quamotion/dotnet-packaging.git
synced 2026-07-09 02:16:10 +00:00
PostInstallScript and PostRemoveScript properties not respecting Condition #82
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @GROSU1 on GitHub (Jun 11, 2020).
I noticed that the conditions for scripts are not being respected and are not adding the content. The only way to add data in the scripts is to remove the condition attribute altogether. Also tried to use the
Pathattribute to add a separate file script as mentioned in this issue but gettingerror MSB4066: The attribute "Path" in element <PostRemoveScript> is unrecognized.Also tried only with
PostInstallScriptandPostRemoveScriptso I don't know if this is affecting pre scripts as well.@aaronegger commented on GitHub (Nov 19, 2021):
There is a substitute for the not working path attribute at the script tag.
To read files you can use $([System.IO.File]::ReadAllText($path"))
Example:
<PreInstallScript>$([System.IO.File]::ReadAllText("preinst"))</PreInstallScript> <PostInstallScript>$([System.IO.File]::ReadAllText("postinst"))</PostInstallScript> <PreRemoveScript>$([System.IO.File]::ReadAllText("prerm"))</PreRemoveScript> <PostRemoveScript>$([System.IO.File]::ReadAllText("postrm"))</PostRemoveScript>