Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi all,

 

It's been a while since I've posted here, but I haven't forgotten all of you, and I'm back with another strange issue.

 

I'm using VS2008 and I've created a standard deployment project for my app. I've created a custom installer class to override the standard one simply to delete a configuration file based on the user's selection during the install. This way I can have one package to deploy both version of the program, and the user selection determines which version is installed. Simple enough right?

 

The problem is that each time the application is started, the Windows Installer appears and "re-installs" the application. This in turn puts both configuration files back in the application directory. It appears that my customer installer is run during this process, but since there is no selection, it doesn't delete either of the 2 files.

 

So, in short, why is the installer running each time the application is started? Any ideas would be greatly appreciated. My code for the custom installer is as follows:

 

public override void Install(IDictionary stateSaver)
       {
           string installedVersion = Context.Parameters["Selection"];
           string installDirectory = Path.GetDirectoryName(Context.Parameters["assemblypath"]);

           //Delete the appropriate configuration file
           if (installedVersion == "Standard")
           {
               if (File.Exists(installDirectory + "\\Configuration.xml"))
                   File.Delete(installDirectory + "\\Configuration.xml");
           }
           else if (installedVersion == "Network")
           {
               if (File.Exists(installDirectory + "\\Config.xml"))
                   File.Delete(installDirectory + "\\Config.xml");
           }
       }

 

Thanks in advance,

 

-Chris

if(computer.speed == "slow")
    {  
       hamster.feed();  
    }
if(computer.speed == "really slow")
    {  
        hamster.kill();
        BuyNewHamster();
    }

  • Administrators
Posted

The only thing that springs to mind is that both files could be marked as being essential to the deployment (I can't remember the exact term - essential or vital or required kind of thing springs to mind).

 

If a required file is missing the installer will attempt to repair the application on launch.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

As always you've come through again. I went into the file system viewer and set the properties of the configuration files to "Vital = false" and the installer no longer runs each time.

 

Once again, thank you.

 

-Chris

if(computer.speed == "slow")
    {  
       hamster.feed();  
    }
if(computer.speed == "really slow")
    {  
        hamster.kill();
        BuyNewHamster();
    }

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...