tags:

views:

1058

answers:

2

Does anyone know how to create a ClickOnce publication for a CD with the publish task in MSBuild?

VS2008 has a 'publish wizard' with a publish to CD radio button choice. It publishes a click once install to a local folder that is suitable for burning to a CD.

We are following a scheduled MSBuild with post processing steps in which we configure it and install it to a given environment, and we'd like to have a scriptable way of producing a CD of the ClickOnce output.

I have been able to make this process work for a web install, and a file share install, but it seems as though the 'publish wizard' does some hidden step that I can't discover.

I'm going out of my mind trying to correlate the various properties in the publish dialogs, the publish wizard, msbuild publish target, mage.exe and mageui.exe. Some items have the same name, some differ between dialogs and properties, some can be set in one area, but not in another.

I can see that automating ClickOnce can be done, but overall, it seems to be a GUI technology, and scripting it seems to go against its grain.

Bill

A: 

Just to add to this, it seems to have something to do with running MageUi on the output of the publish step.

If I publish with MSBuild from the commandline, that looks like:

msbuild  C:\myapp.vbproj /target:publish `
/property:PublishDir=c:\ClickOnce\ `
/property:SolutionDir=C:\trunk\myapp\ `
/property:TargetZone=LocalIntranet `
/property:MapFileExtensions=True `
/property:PublisherName='my publisher' `
/property:ProductName='myProduct' `
/property:BootstrapperEnabled=True `
/property:IsWebBootstrapper=False `
/property:GenerateManifests=True `
/property:ApplicationVersion=1.2.3.4 `
/property:Configuration=Debug `
/property:UpdateUrl=http://localhost/ClickOnce/ `
/property:UpdateEnabled=True `
/property:Install=True

Then I create a folder that is installable from a CD.

When I manipulate the config file, and add additional output from another process to the publish folder, and then use MageUI to regenerate the application and deployment manifests, I create a filebased install that actually installs from the updateURL. If I disconnect from the internet, I get a 'Unable to connect to the remote server' exception, so rather than just checking for updates,it is insisting on installing from the web server as well.

+1  A: 

Well, I've answered my own question.

It's a matter of Http encoding!

When you publish an application, you end up with a folder structure like: C:\myApp\Application Files\version 1

When you alter the contents of the published app (as you do when you want to replace the config file), you have to resign the application and deployment manifests.

And when you do that, MageUi.exe HttpEncodes the "Location" of the application.manifest.

So now, the deployment manifest says that your local file path to the application manifest is something like: Application%20Files\myApp_version\myApp.exe.manifest

And since that path doesn't exist, its causes supposedly CD based installation to actually install from the http: update server, if it exists, and fail if it doesn't

Our work around is to rename "Application Files" to "ApplicationFiles".

Unbelievable...

Did you find out how to do this automatically? I've encountered a similar scenario where the webserver won't allow me to have paths with spaces in it and your solution works if I change the manifest file manually
Matthew Steeples
We do this automatically with a Powershell script.