Unload AppDeployToolkitBanner.png

Hi everybody !

We are starting to use PSADT to package our applications (your work is awesome, by the way !) and the integration of the package in our masters is done as the following :

  • Copy of the package (AppDeployToolkit, Files and script) to %TEMP%
  • Install package using the .ps1 script
  • Remove the package from %TEMP%
    All at once in a single PowerShell session. The issue we have, is that the file AppDeployToolkit\AppDeployToolkitBanner.png cannot be deleted because it is still loaded by PowerShell, and then it causes an error in our masters integration.

Searching a bit in AppDeployToolkitMain.ps1, I saw you are loading the file to calculate its height (starting at line 11935), but never unload it.

Would it be possible for you to add a .Dispose() of that bitmap object in a future release ? Thank you again for that great tool !

I have CMDs to launch installs and uninstalls and I use ROBOCOPY to do the same.
I added the $appDeployLogoBannerObject.Dispose() to my private fork. (See below)
and no, it’s not in the upcoming v3.8.5.

Just add it to your copy.
If It works, I’ll report it as a bug and hope they put it in v3.8.5

# Calculate banner height
[Int32]$appDeployLogoBannerHeight = 0
try {
	[System.Drawing.Bitmap]$appDeployLogoBannerObject = New-Object System.Drawing.Bitmap $appDeployLogoBanner
	[Int32]$appDeployLogoBannerHeight = $appDeployLogoBannerObject.Height
	if ($appDeployLogoBannerHeight -gt $appDeployLogoBannerMaxHeight) {
		$appDeployLogoBannerHeight = $appDeployLogoBannerMaxHeight
	}
	$appDeployLogoBannerObject.Dispose()	#[CHANGED] Must dispose() when install from local cache or else AppDeployToolkitBanner.png is locked open and cannot be removed when removing the pkg
}
catch { }
3 Likes

Please do, I want to make sure it’s put in.

Thank you for your fast answers !
@That-Annoying-Guy you’re in, that’s exactly what I made to fix the issue :+1:

Do you guys have any idea / range for the 3.8.5 release date ?

1 Like

Very very soon. I promise. It’s been getting the time for finishing touches but there’s some nice stuff we’ve added here.

1 Like

Thank you. Now I’m excited to see what’s new :slight_smile: