0

I have program that reads code from a .bin file stored the same directory as the main executable and .dll.

So, the program works completely fine, unless I install it with InstallShield and have shortcuts automatically created. If I open the program via any shortcut, I get an error saying that: "options.bin" could not be found in "directory where the shortcut is currently located" however, if I open the .exe directly then i don't get any errors and the program runs perfectly. Also, if i create my own shortcut manually after installation (with a target directory rather than a clsid), then the program will function perfectly.

here is the code that opens "options.bin":

    private void btnReadFile_Click(object sender, EventArgs e)
    {
        try
        {
            byte[] prog;

            using (BinaryReader reader = new BinaryReader(File.Open("options.bin", FileMode.Open)))
            {
                prog = reader.ReadBytes(6 + 4 * 12 + 2);
            }

            updateProduct(ProductOptions.createFromBytes(prog));
        }
        catch (Exception ex)
        {
            MessageBox.Show("Failed to read from 'options.bin': " + ex.Message);
        }
    }

why do the shortcuts created during the installation cause my program to look for the "options.bin" in the directory where the shortcut is? How can i create a shortcut at time of installation that won't cause this problem? (oh, and i'm using Visual Studio 2012, which doesn't include any setup option, which is why i'm using installshield)

gjudkins
  • 341
  • 3
  • 11

0 Answers0