views:

459

answers:

3

I would like the ability to have a test ClickOnce server for my applications where users can run both the production version and the test version in paralell. Is this possible?

I first tried using the following in AssemblyInfo.cs and also changing the name in the ClickOnce deployment though all this achieved was overwriting the users production version with the test version, likewise it did the same when they went back to the prod server.

#if DEBUG
[assembly: AssemblyTitle("Product Name - Test")]
#else
[assembly: AssemblyTitle("Product Name")]
#endif

I thought I should also clarify that the two deployment locations are different from one another and on different servers.

UPDATE

I've also tried setting the GUID for the manifest depending on the debug mode, but again it does not work (dummy GUID's used below).

#if DEBUG
[assembly: Guid("AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA")]
#else
[assembly: Guid("BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB")]
#endif

Does anybody know how the two are distinguished? It seems that the installer sees them as two seperate programs as I get a confirmation of installation for each, though when I install the second one "Add/Remove Programs" only sees the latter, though the former is still on disk as when I go to reinstall it later it just simply runs but then the add/remove programs switches back to the former name.

+4  A: 

It might sound kind of lame, but the easiest way to do this is to have two EXE projects in your solution. The Main method of each of these will just call the Main method in your original EXE project (which you'll have just switched over to being a DLL).

This means that each exe project can have it's own clickonce publishing settings, as well as it's own app.config file. This means you have have different connection strings for the production and the test version.

Your other option (the one that might seem to make the most sense) is to use MageUI.exe to manually build the clickonce files, which would let you choose a different config file and publish location each time you ran the tool. There's also a command line version (Mage.exe) so you could in theory automate this.

However we found that the solution with two "runner" projects was far far simpler. I'd recommend you try that first

Cheers - Rob

Rob Fonseca-Ensor
I can see the simplicity in the two stub exe's though I can also see it as a burden with maintaining two sets of configs etc. I'll see how I go with `mage` first and then try the latter. I could see maintaining user-settings a real pain with the two stub exe's.
Brett Ryan
I think you're right with the two stubs idea, it doesn't sound logical but does prove to be less messy than with mage, however as mentioned earlier I fear I'm going to find my team coming unstuck with config differences, we may need to manage this some how by merging app.configs from each of the projects through the build process, *ick*!
Brett Ryan
This might help with that: http://stackoverflow.com/questions/132885/best-way-to-switch-configuration-between-developmentuatprod-environments-in-asp#132934
Rob Fonseca-Ensor
One note on using the command line version of mage to automate deployments. It works fine but is a subset of mageui. There are a lot of things you just can't do with the command line mage, like setting your application icon.
whatknott
+1  A: 

I do that all the time. I even have a screen in my application that changes which version a specific user will get. And I'm not doing anything tricky on the app side, all the magic is on the web server hosting the ClickOnce files.

Take a look at this article my buddy wrote, it explains how we did it.

http://www.infoq.com/articles/ClickOnce-Versioning

Jonathan Allen
I'm actually trying to allow two click-once installs of the same application though different versions, one the production tree version and another on another update server which is the test tree.
Brett Ryan
On another server... yea, it sounds like you have to play with MageUI.
Jonathan Allen
+1  A: 

Try changing the Assembly Name in the Application tab in the properties window.

jaywalker