Results 1 to 10 of 10

Thread: [2005] User needs 2 or more instances

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    263

    [2005] User needs 2 or more instances

    I made a VB.NET 2005 application package that stores its configuration using my.settings.

    When my package is installed on a computer, some users may need to run two or more instances of my program, each one having different settings.

    The only way I managed to do it, the user must go in my program folder, create a copy of the executable with a different name. Because settings are stored in an XML file based on the executable file name, each program has its own settings.

    However this is not elegant, if the user installs an upgrade, he must delete and recreate the executables copy every time.

    Is there a way to let the user run the same executable, and by using a different command line parameter, let the program use a different set of settings?

    For example, my executable name is prog.exe
    I make a shortcut to prog.exe with the parameter "home"
    I make a shortcut to prog.exe with the parameter "office"
    If I start both shortcuts, the first program would use the "home" settings while the second program would use the "office" settings.

  2. #2
    Frenzied Member
    Join Date
    May 2006
    Location
    Toronto, ON
    Posts
    1,093

    Re: [2005] User needs 2 or more instances

    Use the setup wizard (Under Setup and Deployment in New Projects in Visual Studio) to create your setup.exe. It has a property called Remove Previous Versions. If you set that to false, it won't remove previous versions.

    You may have to do some playing around with the version numbers to get it to install correctly, but if you google that property, you should be able to get some examples of it.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    263

    Re: [2005] User needs 2 or more instances

    I definitly do not want to install my program 2 or 3 times, just because my user needs to use my program with 2 or 3 sets of settings !!!

    Assuming my program receives a parameter called "Instance", in VB6, I could easily read my settings with "GetSetting(exename, Instance, SettingName, SettingValue)" and save then with "SaveSetting exename, Instance, SettingName, SettingValue".

    How can I do the same thing with VB.NET (something like "Instance.settings.MyValue1")?

  4. #4
    Frenzied Member
    Join Date
    Mar 2006
    Location
    Pennsylvania
    Posts
    1,069

    Re: [2005] User needs 2 or more instances

    To me, it doesn't sound like it would work. Let me explain why.

    When using My.Settings, there are properties in there associated to the ones in the XML configuration file. If you have two or more potential files, then you could either put them all under the My.Settings, or have two settings variables, which I don't think would work well. If you have two settings variables, then you are overriding the default behavior of Visual Basic, which may or may not cause some (serious) problems. Also, if you put them all under one settings variable, which probably won't work, then you need some properties to read from one file and some properties to read from another. I don't think the Settings class would be used for something like that.

    Keep in mind that the application settings are supposed to be simple. The form size, background color, and default location. Stuff like that. When you are dealing with multiple files and complex values, you are most likely better off with using MySQL, MSSQL, or ADO .NET.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    263

    Re: [2005] User needs 2 or more instances

    OK, let's say I decide to go a different route.

    How can I let the user install the same version of my program twice, so that each version would have a separate set of settings.

    Even with the RemovePreviousVersion set to false in my Setup & Deployment package, when I try to install the second copy of my program (by providing a different installation folder), I get a window asking me to "Repair" or "Delete" my package.

  6. #6
    Frenzied Member
    Join Date
    Mar 2006
    Location
    Pennsylvania
    Posts
    1,069

    Re: [2005] User needs 2 or more instances

    Generally, installing the same version of your program twice when the difference is highly insignificant, you should consider a redesign.

    Perhaps you should try incorporating some polymorphism within your code.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    263

    Re: [2005] User needs 2 or more instances

    99% of my customers only use one instance of my program. I have a new customer that needs two or more instances of my program, each running simultenously on the same PC, each having its own settings. My problem is that this must be done before next monday ... there is no time to redesign my application!

    So it is possible to install the same program twice on the same computer in two separate folders?

  8. #8
    Frenzied Member
    Join Date
    Mar 2006
    Location
    Pennsylvania
    Posts
    1,069

    Re: [2005] User needs 2 or more instances

    If you're using good object orientation, you should never have to re-design the whole application. Besides, this stuff is easy. I'll help you out.

    You might have mentioned this already, but how are you specifying which settings file to use? I heard you talking about two versions of the same application using different settings files, but that doesn't sound very good.

    Have you thought about incorporating into the program an OpenFileDialog so they can choose which XML settings file to use? This way you can still only require only one version of the application but you can open up two instances of it and whichever configuration file you want.

    Anyways, as time seems to be an issue, perhaps it would just be better to do it the sloppy way. Do you really need to install your application? Can you just have it in a folder? If you did that, then there would be no installer conflictions. However, I'm sure you can somehow install two different versions of the same applications, provided you edit the assembly correctly.

  9. #9
    Frenzied Member
    Join Date
    May 2006
    Location
    Toronto, ON
    Posts
    1,093

    Re: [2005] User needs 2 or more instances

    Quote Originally Posted by JacquesLebrun
    99% of my customers only use one instance of my program. I have a new customer that needs two or more instances of my program, each running simultenously on the same PC, each having its own settings. My problem is that this must be done before next monday ... there is no time to redesign my application!

    So it is possible to install the same program twice on the same computer in two separate folders?
    It should be. If you're using a setup program to install your app, you can just have it name the second instance something else and the computer it's installed on shouldn't even realize the two apps are the same program.

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    263

    Re: [2005] User needs 2 or more instances

    The more I think about it, I realize then I cannot use a MSI package because my new customer may need to run more that one instance of my program, but some instance may have to be a different version. I may have to use a XCOPY installer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width