Visual-studio – How to automatically rename the “Application Files” folder in a ClickOnce deployment

clickoncevisual studio

We're currently using Visual Studio to build our ClickOnce deployment packages, but we'd like to rename "Application Files" because the webserver we're using does not support spaces.

We've found that if we go into the .application file directly we can modify the path that is being pointed to, and we can also rename the folder manually.

Does anyone know of a way to automate this, whether it's using MageUI or any other utility? It's tempting to just put a batch script together that makes the changes for us. The deployment is using unsigned files as well, as we don't need to worry about a certificate (it's only an internal app)

Best Answer

As no one seems to know the answer to this I've found a way to do it myself. I have created a powershell script. Note that this will only work on unsigned manifests.

gci -Recurse -include *.application | ForEach-Object { [System.IO.File]::WriteAllLines($_.FullName, [System.IO.File]::ReadAllText($_.FullName).Replace("Application Files", "ApplicationFiles")) }
gci -recurse | Where {$_.psIsContainer -eq $true} | Where {$_.Name -eq "Application Files"} | ForEach-Object { $_.MoveTo($_.FullName.Replace("Application Files", "ApplicationFiles")) }

My powershell isn't amazing so there may be a better way of doing it, but that was what I came up with