ClickOnce publish to a non available URLs

If you are publishing an application with ClickOnce you may not have the final URL for the deployment site e.g. you are planning to use www.myapp.com but you have no access now, this happens to us quite oftan as a software house when we are developing something that will be deployed with ClickOnce within a client’s network.

You can of course publish to you local machine but the problem is the temporary URL you use to deploy is stored in the ClickOnce manifest, which has a checksum so you cannot edit it by hand.

To get round this we have done the following:

  1. In the c:\windows\system32\etc\drv\hosts add www.myapp.com with the IP address 127.0.0.1
  2. You can now try to deploy to http://www.myapp.com/myApp, but it fails with a 401 security error (maybe giving you a login box that does not work)
  3. To address this use workround 1 in http://support.microsoft.com/default.aspx?scid=kb;…, this allow URLs other than localhost to work as loopback, basically you add a registry key to disable the loopback check
  4. After a reboot you can now deploy to http://www.myapp.com/myApp, you may get a login box, but yoy can now use any valid login for the box.
  5. Once this is done the publish works locally, and if you look in the manifest you see the right URL. You can then ship off the whole directory to the live site as required

Leave a Reply

Your email address will not be published.