views:

335

answers:

4

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)

+2  A: 

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

Matthew Steeples
A: 

Please can you advise as to how to implement this Powershell? I am new to Powershells but need to change the "Application Files" folder name to one without a space so I can publish to a BT webspace.

Ivor Richards
Please see my accepted answer as to how we managed this. The 2 line script will go through all sub directories, rename the folders, and update the application manifests
Matthew Steeples
Thanks Matthew but I am particularly dim and don't know how or where to run these scripts. Please can you give me a complete idiots guide? Thanks
Ivor Richards
A: 

First, try this manually.

Publish the application to a folder (set the publish location to something like C:\publish, and the installation URL correctly, like http://myserver/myapp/).

Then go in and rename Application Files to ApplicationFiles in C:\publish.

Go to the C:\publish\ApplicationFiles\yourapp_a_b_c_d\ folder and delete yourapp.application. (Trust me, if you don't, mageui will crap out when you re-add the files).

Run MageUI (it's in c:\program files\microsoft sdks\windows\v7.0a\bin or v6.0a\bin, depending on which version of VS you are running).

In MageUI, click Open, look for c:\publish\ApplicationFiles\yourapp_a_b_c_d\yourapp.exe.manifest and open it (where a_b_c_d is your version and yourapp is your application name).

You should see the name and stuff. Click on Files. Make sure "when populating add the deploy extension..." is checked, then click Populate (although come to think of it, all should have that extension, unless you changed it in VS). This will add all of the files in the folder to the application manifest/

Save and sign the application manifest.

Then clck Open again, open c:\publish\yourapp.application.

Click "Application Reference". On the right, click Select Manifest. Browse to the one you just edited (C:\publish\ApplicationFiles\yourapp_a_b_c_d\yourapp.exe.manifest). This updates the deployment manifest so it can find the list of files in the right application manifest. Save and sign the deployment manifest (yourapp.application).

Copy the folders to the webserver, it should work.

Now, if that does work for you, you can replace the mageui stuff with Mage commands, and probably do some simple scripting to copy the files to the new folder or rename the "Application Files" to "ApplicationFiles".

I can provide the Mage commands for you if you need them.

RobinDotNet
A: 

Hi! Thank you so much for this! Worked a charm!

Ivor Richards